In my default.aspx page on the OnPreInit method (overridden) I simply add this :
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
if (Session["ThemeName"] == null)
{
Session.Add("ThemeName", "Green");
Page.Theme = ((string)Session["ThemeName"]);
}
else
{
Page.Theme = ((string)Session["ThemeName"]);
}
}
Then from anywhere on the page I simply call this :
if (Session["MyTheme"] == null)
{
Session.Add("ThemeName", "Black");
}
else
{
if (((string)Session["ThemeName"]) == "Green")
{
Session["ThemeName"] = "Black";
}
else
{
Session["ThemeName"] = "Green";
}
}
Hope this helps,
- Tim