Wednesday, November 17, 2010

How to change theme in the whole application in asp.net?

i made two radio buttons in which 2 themes in .css and skin files are defined.On selecting the radiobuttons,the particular theme is called and applied but i want after selection the theme it should be applied to the whole application but not only to that particular page.how it is possible??? can we call webconfig files differently???How to change theme in the whole application in asp.net?
I like to change my theme programmatically for example on the first of December.

I've got the following page directive in my web.config:



%26lt;pages theme=';default';%26gt;%26lt;/pages%26gt;



Now I'd like to change to the cristmas-theme for the whole application on a certain criteria.

I put this code into my default.aspx



private void Page_PreInit(object sender, System.EventArgs e)

{

if(december){

Page.Theme = ';christmas';;

}

}



This code works fine, but only for the page default.aspx.How to change theme in the whole application in asp.net?
the CSS would have to be applied to the whole website.



A session variable used to store what CSS theme is selected would help apply the theme to the whole site.



When the page is being rendered on the server it would look at the session variable to know what css theme to use.
Select your theme and apply in .css.Then .css file should call in all the pages.then entire application will change

No comments:

Post a Comment