This project is read-only.

Dynamically Change Theme per Page

Topics: ASP.NET 2.0, Themes
Jan 27, 2011 at 10:29 PM

Is it possible to have a different theme / masterpage based on some rules? 

Eg. I need the front page not to have the sidepanel and to have a different header.

I tried to change:


and it works but that sets the new theme for all the other pages too. Is it possible for just that page to have the different theme?

Many thanks

Jan 27, 2011 at 10:36 PM

Putting this code in the .cs file of any page will omit the sidebar.



 protected void Page_Load(object sender, EventArgs e)
        PlaceHolder phSidebar = Master.FindControl("phSidebar") as PlaceHolder;
        if (phSidebar != null)
            phSidebar.Visible = false;

Jan 28, 2011 at 1:52 AM

I do not have an answer but see if this will help:

I think it might be close to what you need to do.

Jan 28, 2011 at 6:39 AM

Here's a helpful post, I think.