473,387 Members | 1,859 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,387 software developers and data experts.

Body Classname from Codebehind page

Hi,
I want to switch some info in the Codebehind page.
Everything is working but one thing.
I need to set the classname of the body at the page load.
I cannot find on how to do this from the code behind page.

Normaly i take the protectec System.Web.UI.HtmlControls. ..... Controls or other controls and this works fine.
But now one more step on doing this on the body tag and i am very much helped.

Regards,
RJ
Nov 19 '05 #1
2 1409
RJ:
Stick on ID on the body with a runat="server" declare it as an HtmlControls.HtmlGenericControl

and then you can do

control.Attributes.Add("Class", "YourClass")
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!)
"RJDev" <rj*******@hotmail.com> wrote in message news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi,
I want to switch some info in the Codebehind page.
Everything is working but one thing.
I need to set the classname of the body at the page load.
I cannot find on how to do this from the code behind page.

Normaly i take the protectec System.Web.UI.HtmlControls. ..... Controls or other controls and this works fine.
But now one more step on doing this on the body tag and i am very much helped.

Regards,
RJ
Nov 19 '05 #2
Thnx Karl for your support,
This works fine.

Stupid of me not to think of it this way.

Thnx again
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> schreef in bericht news:e%****************@TK2MSFTNGP09.phx.gbl...
RJ:
Stick on ID on the body with a runat="server" declare it as an HtmlControls.HtmlGenericControl

and then you can do

control.Attributes.Add("Class", "YourClass")
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!)
"RJDev" <rj*******@hotmail.com> wrote in message news:ed**************@TK2MSFTNGP12.phx.gbl...
Hi,
I want to switch some info in the Codebehind page.
Everything is working but one thing.
I need to set the classname of the body at the page load.
I cannot find on how to do this from the code behind page.

Normaly i take the protectec System.Web.UI.HtmlControls. ..... Controls or other controls and this works fine.
But now one more step on doing this on the body tag and i am very much helped.

Regards,
RJ
Nov 19 '05 #3

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

Similar topics

2
by: Big D | last post by:
Is there any way to, from the page class, send literal output to the <HEAD> of te page, or within the <BODY onload="('theFunctionIAddedToTheHead');"> ? I need to do this in a class that inherrits...
3
by: Alan No Spam | last post by:
I am using Visual Studio 2003 and in order not to repeat body tag details in every page <body leftmargin=0 topmargin=0 .... I put those details as an variable in my class: public class...
10
by: darrel | last post by:
I have this structure: mypage.aspx (class = mypage) myusercontro.ascx On the mypage.aspx I can declare a variable: animal = "monkey" I can read this from the UC by simply doing this:...
2
by: darrel | last post by:
I have a page that I need to attach a javascript to the BODY tag when the page first loads (but not on postback). Is there a way to do that via codebehind? I've attached javascript to elements...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.