Digital Colony!

EnableTheming Propery Ignored - The Bug and the Fix

ASP.NET 2.0 gave developers a server-based styling technology called Themes. From the web.config file a single line can dictate how an entire web site will look. The theme of this site at this writing is called Joshua.
<system.web>
 <pages theme="Joshua"/>
</system.web>
Microsoft tells us that is we want to turn off theming for a given page and not the entire site, we can set the EnableTheming property to false. But this doesn't work. The web.config setting will override the Page directive.
<%@ Page Language="C#" EnableTheming="false" %>
To get around this bug for a single page, specify a Theme with no value in the Page directive.
<%@ Page Language="C#" Theme="" %>

Labels: , ,

AddThis Social Bookmark Button

6 Comments:

Anonymous alcovia said...

Michael, I stumbled across your web site - very good! I am mostly working in php but I find this useful. However, your discussion of enabling and disabling themes needs to be linked to an explanatory page about themes themselves - what they are, how to use and what effect they have. alcovia

6/09/2007 8:58 AM

Blogger MAS said...

Good idea. There have been books written about the topic. Perhaps a super quick overview would be a good addition to the site.

6/09/2007 9:03 AM

Anonymous Anonymous said...

very useful. right up this ally, anyone else get a little upset that the cascade in web.config simply fails to operate on some instances???

8/29/2007 9:25 AM

Anonymous Anonymous said...

i would also think that assigning a value that simply doesn't exist would throw some type of internal error in .NET, which would have to create some type of performance issue.

again, vyer glad you posted this but the solution from microsoft is very microsoft like...

8/29/2007 9:27 AM

Anonymous Anonymous said...

In my case, I would like to disable the them at the control level only (example a gridview). The EnableTheming="false" on the gridview does not appear to have any effect either. Do you know if there is a workaround here also?

9/23/2008 9:14 AM

Blogger MAS said...

I did not know the EnableTheming="false" failed on a gridview. Try specifying the colors directly on the control to see if they have an effect.

9/23/2008 9:26 AM

 

Post a Comment

 

Digital Colony Copyright © 1999-2008 XHTML   508
This site uses Blogger, which is not 100% XHTML compliant.
Try...Catch Disclaimer: For brevity many examples do not include error handling. That is your responsibility.