Click here to Skip to main content
14,667,814 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100