Blog - .NET, ASP.NET, AJAX, Ruby and more
  • Google Banner 2

Theme Error when Themes are disabled?

I received an interesting error today when I tried to create a WebForm which didn’t have any content on it. 

Using themed css files requires a header control on the page. (e.g. <head runat=”server” />).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Using themed css files requires a header control on the page. (e.g. <head runat=”server” />). 

Fair enough, I do have a Theme set in my Web.Config, so on to disable themes for the page, a la:

<%@ Page Language=”C#” EnableTheming=”false”  %>

Run the page again, same error.  What gives?  Then I ran across Rick Strahl’s WebLog (specifically this: http://www.west-wind.com/WebLog/posts/4662.aspx). 

The fix I ended up using was:

<%@ Page Language=”C#” EnableTheming=”false” Theme=”"  %>

A bit strange the disabling theming doesn’t take care of this.

This entry was posted in ASP.NET, C# and tagged . Bookmark the permalink. Both comments and trackbacks are currently closed.

Damien White is a developer in Connecticut that simply loves coding. Ever since he was young, he has had a driving passion for computers and software development, and a thirst for knowledge that just cannot be quenched. He’s happy to share what he knows in his quest to learn as much as possible.

One Comment

  1. Posted March 11, 2008 at 1:11 pm | Permalink

    Thanks for this post! I was having the same problem with a non-site themed page where all its contents were added at runtime. When I saw your post it was like a smack to the side of my head to wake me up.