OK, so it's slightly more complicated with WebForms to do this dynamically,
but anything that can be done in HTML can be done with ASP.NET, so let's get
to work.
First, set up your body tag to run in the server:
<body runat="server" id="myBody">
....
</body>
Now, you can set up a declaration of that in your codebehind:
protected HtmlGenericControl myBody;
Because you are using the generic control, you don't get direct access to
the bgcolor attribute, so you have to use the generic implementation in your
Page_Load event:
myBody.Attributes.Add("bgcolor", "#ffffcc");
There may be an easier way, perhaps, but this will get the job done.
--
Chris Jackson
Software Engineer
Microsoft MVP - Windows XP
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--
"Newton" <ne***********@pobox.sk> wrote in message
news:02****************************@phx.gbl...
Hi,
I am working with ASP.NET using C#. I put some labels,
buttons and editboxes on a webform. But i need how to
change a background color of the webform from the source
code. In windows application it is easy, because I can
call name of that form. But how is it in web
application ?
Somebody help me please,
thank you
Peter