Click here to Skip to main content
14,698,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I have to apply theme for all pages i created to themes one is red and another one is orange its showing only default red if i changed in dropdownlist it's not changing i implemented code in master page
i wrote
protected void Page_PreInit(object sender, EventArgs e)
   {
       string thm;
       thm = (string)Session["themeSelected"];
       if (thm != null)
       {
           Page.Theme = thm;
           DropDownList1.Text = thm;
       }
       else
       {
           Session["themeSelected"] = DropDownList1.Text;
           Page.Theme = "Blue";
       }

   }

   protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
   {
       Session["themeSelected"] = DropDownList1.Text;
       Server.Transfer(Request.FilePath);
   }

and after i changed in web.confing <pages theme ="Orange">
where i did mistake?
Posted
Comments
_Ashish 26-Feb-11 12:27pm
   
you implemented code in master page, which won't work as masterpage has no such event Page_PreInit. It will only work in ASPX page.

You have to create a ExtendedPage derived from Page as described in links below.

1 solution

   
Comments
Espen Harlinn 26-Feb-11 9:26am
   
Good links :)
Sandeep Mewara 27-Feb-11 5:18am
   
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900