简体   繁体   中英

Determine StyleSheetTheme based on page's master page in asp.net

All,

I am using asp.net 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM