Themes Change onfly

  • Thread starter Thread starter suresh.csharp
  • Start date Start date
S

suresh.csharp

Hi,
I have created two themes in our application. Trying to apply themes
on fly to the entire application(all pages..) .

1. In web.config file mentioned <pages theme="theme1" />, It is
applying for the entire site.
2. In each Page, PreInit event menthod if I mention
Page.Theme = Profile.MyTheme;
It is applying the theme to which ever pages, I have declared
PreInit method with above code.

I am trying to set in one place for the entire application. Instead of
specifying in all pages.
Page_PreInit method and Page.Theme="" code.

I am using single Master page, I thought if I setup for Master page It
will apply to the entire site. But In Page_PreInit method for Master
mentioned above code. It is not working.

Can any one tell which is the better way to do this one.


Thanks
Suresh
 
The master page doesn't have any PreInit event.

Make a base class where you override PreInit, then you just let all your
pages inherit that class instead of Page:

public class ThemedPage : Page {
// override PreInit here
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top