Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting the page background color progmaticly ?

Status
Not open for further replies.

Webwzrd

Programmer
Apr 23, 2002
40
US


I haven't needed to do this in DOT.NET until now. Anyone know how to change the page background color using the code behinde???? I had the folowing code sample, but it dosent seem to work:

Code:
bodyElement.Attributes("bgColor") = "Gainsboro"

I also set the page Body tag to run at server.
Any Ideas would be appreciated.





Thanks in advance!

 
This works for me when I had the body running at the server:

private void Page_Load(object sender, System.EventArgs e)
{
pageBody.Attributes["bgcolor"] = "Gainsboro";
}

...so I don't think your problem is with the line of code you posted.
 
Thanks BuilderBum!

It's still not working. What Imports are you using at the top of your page? ie(system.web.ui)



 
This would be the relevant one:

using System.Web.UI.HtmlControls;

where the page is declared like:

protected System.Web.UI.HtmlControls.HtmlGenericControl pageBody;

But if you can compile, you may at least be set up correctly as far as that goes.

Maybe if you post the code?


Get a FREE iPod by helping me get mine! Click here:

More about the company and deal:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top