Using Themed CSS Files Requires a Header Control

When using ASP.NET themes and you specify the global theme in web.config you can run into problems when you want to create a page that does not use the theme.

If you just remove the <asp:Content> elements the page will error and you will probably get this message:

Using themed css files requires a header control on the page. (e.g. <head runat="server" />).

You should be able to get round this by setting EnableTheming="false" in the page directive:

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

Unfortunately this by itself does not work and you need to clear the Stylesheet and Theme values as well:

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

Now you should be able to create a page without using the global theme.

This entry was posted in Programming and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

* = Required