473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

problem with <body> tag asp.net

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?

Nov 18 '05 #1
1 1096
Chris Millar wrote:
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
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andrés Giraldo | last post by:
Hi! It's possible to register some script between the <head> and </head> actually I'm Using RegisterStartupScript and RegisterClientBlockScript, but it works on the body By the way... how...
2
by: ryan.mclean | last post by:
Hello everyone. Hope ya'll had a nice New Year. Anyway, my question is why won't this work? I must be doing something dumb . . . here is the code: in the body tag, I have this code (just to...
1
by: Dung Ping | last post by:
For instance, one set is: <body onload="blinking_header()" onunload="stoptimer()"> Another set is: <body onload="writemsg()" onunload="stoptimer()"> They represent two functions. How to...
3
by: francescomoi | last post by:
Hi. I'm trying to insert some text between <head> and <body> but I'm not able. I try with: -------- bodyPoint = document.getElementsByTagName('body'); var myLink =...
15
by: Frances | last post by:
<html> <head> <script> function doIt() { var list = document.forms.product; var selItem = list.options.value; ^^^^^^^ </head>
5
by: SteveS | last post by:
Hello, I'm having trouble figuring out how to dynamically add an onload and resize event to the <body> tag. I've looked on the web and in MS documentation unsuccessfuly. Does anyone know the code...
1
by: milas57 | last post by:
hello everyone i have a homepage which introduce the company website as shown below im having trouble to find some javascript code when i click on the header link like servives the body content...
23
by: Xah | last post by:
Here's a interesting case of invalid html 4 strict file. In summary, if you have <body></bodywithout any content, the file would be invalid under html 4 strict. Valid if html 4 lose. <!DOCTYPE...
3
by: PYG | last post by:
Hi everybody I have a simple question : If i use this code : <body style="font-size:24px;color:blue;"> Text in body <table> <tr><td> Text in table
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.