This is a migrated thread and some comments may be shown as answers.

Where in the page lifecycle do stylesheets get loaded?

2 Answers 110 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
LeBear
Top achievements
Rank 1
LeBear asked on 12 Sep 2009, 08:02 PM
Hello,

I've created a site management system that has a base theme that is loaded via the pages directive in the web.config:
<pages ... styleSheetTheme="Base">...</pages> 

Then, to customize the look and feel for an individual site, I reference a theme in the Page_PreInit method:
Me.Theme = "SiteTheme" 

This works great.  Anything defined in the Base theme gives you a standard appearance for any given component of the system.  However, if you want to override the look and feel for an individual site, you can declare the same CSS definitions inside the Site Theme.

If I were to use the StyleSheet Manager to combine CSS files, when would they get loaded.  My goal would be to manage all of the Base theme information with the StyleSheet Manager and still allow them to be overridden by the Site Theme.

Another side question:  Would the StyleSheet Manager help beyond just combining all of the CSS files in my Base theme into a single CSS file?

Thank you.

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 15 Sep 2009, 01:38 PM
Hi Barry,

A control registers with RadStyleSheetManager during its PreRender event if and only if it is using any of the built-in skins. RadStyleSheetManager currently combines only embedded CSS files. If you are using a custom skin you can check this help topic how to embed it.

All the best,
Albert,
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
LeBear
Top achievements
Rank 1
answered on 15 Sep 2009, 04:33 PM
Hello Albert:

You didn't answer my question, but in retrospect, I realize the answer is pretty simple simply by looking at the generated HTML in a page within the application.

To answer my own question:

If I have a theme specified as the styleSheetTheme within the web.config, all CSS files for that theme appear in the head of the HTML output first.  If I then have a theme specified for the pages (which I set in the Page_PreInit method of all pages), the CSS files for that theme appear next, which allows them to override CSS settings in the styleSheetTheme.  Finally, the last CSS file referenced in sequence is the generated resource created by the StyleSheetManager.

As such, if a single CSS class appears in all three places, the one placed into the StyleSheetManager resource will override the others.

For my purposes, I don't want to place any CSS information from the base theme (specified as the styleSheetTheme) into the StyleSheetManager, as I design it so that those classes can be overridden by the site-specified theme in the Page_PreInit method.

Thanks.
--Barry
Tags
ScriptManager and StyleSheetManager
Asked by
LeBear
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
LeBear
Top achievements
Rank 1
Share this question
or