在处理使用母版页的ASP.NET应用程序时,注意Page和Master指令都包含EnableTheming属性.
假定在ASP.NET应用程序的Web.config文件中定义了主题,在Master页面中用EnableTheming属性指定禁用主题特性,使用该Master页面的内容页面也会有什么结果?如果内容页面没有指定主题特性(即没有使用EnableTheming属性),就采用Master页面上指定的设置,不应用主题。即使在内容页面上设置了EnableTheming属性,也优先采用Master页面上指定的EnableTheming属性。详细请看下表:(图中Enable Theming应为EnableTheming)
应用程序设置 |
母版页设置 |
内容页面设置 |
结果 |
Theme="blue" |
无 |
Theme="pink" |
使用内容页面主题 |
Theme="blue" |
无 |
Enable Theming="false" |
使用应用程序主题css |
Theme="blue" |
无 |
无 |
使用应用程序主题 |
Theme="blue" |
Enable Theming="false" |
Theme="pink" |
使用内容页面主题css |
Theme="blue" |
Enable Theming="false" |
Enable Theming="false" |
使用内容页面主题css |
Theme="blue" |
Enable Theming="false" |
无 |
使用内容页面主题css |
无 |
无 |
Theme="pink" |
使用内容页面主题css |
无 |
无 |
Enable Theming="false" |
无外观设置 |
无 |
无 |
无 |
无外观设置 |