Hi, one of my colleague was struggling that how to set value of Page’s background color in ASP.NET Code??
Problem:
Actually we want to set a page’s background color on Page_Load. and value changes everytime..how can i achieve it?
Solution:
Nothing magic in it just two lines will do the same:
HtmlGenericControl bodytag = (HtmlGenericControl)Page.Master.FindControl(“body”);
bodytag.Style.Add(“background-color”,”#000999″);
for it my Master Page has body tag declared like this:
<body ID=”body” runat=”server”/>
That’s it..