How to make dynamic css and theme

To make a Theme Changing Programatically

you need to set the Page.theme on preinit event of a Page.

Make a base class that override the preinint and your logical of changing theme.

PreInit

Use this event for the following:

  • Check the IsPostBack property to determine whether this is the first time the page is being processed.

  • Create or re-create dynamic controls.

  • Set a master page dynamically.

  • Set the Theme property dynamically.

  • Read or set profile property values.

    NoteNote:
    If the request is a postback, the values of the controls have not yet been restored from view state. If you set a control property at this stage, its value might be overwritten in the next event

And then how to make dynamic css? just make a ashx which content type = text/css

finally how to Override the css from the App_Theme, which will generate pattern like app_them234234.css

you can add another link to the page by using page.header.add("<link string..");

 

Share this post: | | | |
Published Tuesday, July 21, 2009 9:20 AM by cipto
Filed under:

Comments

No Comments