Re: Applying a user selected theme
Thanks very much for the quick reply;
I am quite sure that it is inheriting from the BasePage, i could be wrong.
Here is the code for the base page:
using System;
using System.Web;
public class BasePage : System.Web.UI.Page
{
private void Page_PreInit(object sender, EventArgs e)
{
HttpCookie preferredTheme = Request.Cookies.Get("PrererredTheme");
if (preferredTheme != null)
{
Page.Theme = preferredTheme.Value;
}
}
private void Page_PreRender(object sender, EventArgs e)
{
if (this.Title == "Untitled Page" || string.IsNullOrEmpty(this.Title))
{
throw new Exception("Page title Cannot be \"Untitled Page\" or an empty string.");
}
}
public BasePage()
{
this.PreRender += new EventHandler(Page_PreRender);
this.PreInit += new EventHandler(Page_PreInit);
}
}
And theme in the browser is what ever is in my configration file which looks like this.
configuration>
<system.web>
<pages theme="DarkGrey"></pages>
<compilation debug="false" targetFramework="4.0" />
</system.web>
</configuration>
As this is DarkGrey now so browser displays the dark gray if it was Monochrome browser displays the Monochorme and brower does not displays the theme i select form the dropdown list.
Tariq
Last edited by tariq; July 4th, 2010 at 12:40 PM..
|