ASP.NET 4 @Page EnableTheming

Hey there!

Today I was going over my “Themes and Skins” chapter in my ASP.NET 4 book and I noticed the following “bug”:

Prereq’s:

  • One *.aspx page
  • One theme (be it SmokeAndGlass, /care)

Modify the web.config like this:



  
    
    
  

This enables the “SmokeAndGlass” theme for all your *.aspx pages in the current application.
Next, open up the *.aspx page and modify the page directive:

<%@ Page Language="C#" 
AutoEventWireup="true" 
CodeBehind="Default.aspx.cs" 
Inherits="Chapter6.singlepagetheme.Default" 
EnableTheming="false" %>

Run the page and notice how the theme is still applied to the page, altho EnableTheming is set to false.
Either I’m doing something wrong but I seriously doubt that since I’m following the instructions in the book…

Any thoughts / ideas?

* EDIT: The EnableTheming attribute on ASP.NET controls does work.
* EDIT 2: Following link takes you to the MSDN page on how to disable themes. Mind the “Community Content” comment: http://msdn.microsoft.com/en-us/library/kx3kzht7.aspx
* EDIT 3:

Text snippet from my ASP.NET book

Leave a Reply

Your email address will not be published.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.