Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change Body from Code Behind
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01145622
Message ID:
01145694
Views:
19
>Does anyone know how to access the HTML BODY from the code behind? I want to change the CSS class of the BODY in my page load event.

Sure you can make any tag on a page a server control by adding a runat="server" to the tag.

Just use:
<body runat="server" id="tagBody">
then in codebehind:
this.tagBody.Attributes.Add("class","mycssclass");
+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform