ActiveX ActiveX - 7 months ago 41
ASP.NET (C#) Question

Determine StyleSheetTheme based on page's master page in


I am using 2.0. I would like to return StyleSheetTheme name based on current page's master page. Basically, the idea is that I have a set of pages that use specific master page and another set that use another master page (content pages, vs print output pages) and would like to load a different theme assets based on that condition. Here's my problem:

The StyleSheetTheme property is invoked for the page to get page's theme name before the master page is known for given page (ie. this.Master on the page returns null). Any ideas to make this work?

I'd like to emphasize that I am using StyleSheetTheme prop not the Theme prop.


I decided to use Request.Url to determine what theme to use. Then I apply the theme based on request path. Its a very flexible solution that will for us here.