problem with <body> tag asp.net

C

Chris Millar

wondered if anyone could help me - i'm trying to control the value of an
attribute of the BODY tag on a page. So i've got:

<html>
<body test="colin">
<form ......
** content **
</form>
</body>
</html>

I want to affect the value of the 'test' attribute from the code-behind
file.

I've tried setting up the body tag as a server control (e.g. <body id="fred"
runat="server" test="colin">) and adding in a protected var in the
codebehind like this:
protected System.Web.UI.HtmlControls.HtmlGenericControl mainbody;

... but it throws an exception somewhere deep down in the .net libraries
before it runs any of my code. Anyone got any ideas about how I could do
this?
 
R

Rutger Smit

Chris said:
wondered if anyone could help me - i'm trying to control the value of an
attribute of the BODY tag on a page. So i've got:

<html>
<body test="colin">
<form ......
** content **
</form>
</body>
</html>

I want to affect the value of the 'test' attribute from the code-behind
file.

I've tried setting up the body tag as a server control (e.g. <body id="fred"
runat="server" test="colin">) and adding in a protected var in the
codebehind like this:
protected System.Web.UI.HtmlControls.HtmlGenericControl mainbody;

.. but it throws an exception somewhere deep down in the .net libraries
before it runs any of my code. Anyone got any ideas about how I could do
this?

And what if you use a Literal control within the body tag?

<body<asp:literal ID="lit" Runat="server" />>

Maybe not that neat but atleast it works.

--

//Rutger

DoDotNet@KICKTHIS_Gmail.com
www.RutgerSmit.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top