{"id":700,"date":"2011-09-20T15:10:29","date_gmt":"2011-09-20T15:10:29","guid":{"rendered":"http:\/\/dirk.schuermans.me\/?p=700"},"modified":"2016-01-07T10:46:23","modified_gmt":"2016-01-07T10:46:23","slug":"asp-net-4-page-enabletheming","status":"publish","type":"post","link":"https:\/\/dirk.schuermans.me\/?p=700","title":{"rendered":"ASP.NET 4 @Page EnableTheming"},"content":{"rendered":"<p>Hey there!<\/p>\n<p>Today I was going over my &#8220;Themes and Skins&#8221; chapter in my ASP.NET 4 book and I noticed the following &#8220;bug&#8221;:<\/p>\n<p><!--more--><\/p>\n<p>Prereq&#8217;s:<\/p>\n<ul>\n<li>One *.aspx page<\/li>\n<li>One theme (be it SmokeAndGlass, \/care)<\/li>\n<\/ul>\n<p>Modify the <strong>web.config<\/strong> like this:<\/p>\n<pre name=\"code\" class=\"xml\"><?xml version=\"1.0\"?>\r\n<configuration>\r\n  <system.web>\r\n    <pages theme=\"SmokeAndGlass\"><\/pages>\r\n    <compilation debug=\"true\" targetFramework=\"4.0\"><\/compilation>\r\n  <\/system.web>\r\n<\/configuration>\r\n<\/pre>\n<p>This enables the &#8220;SmokeAndGlass&#8221; theme for all your *.aspx pages in the current application.<br \/>\nNext, open up the *.aspx page and modify the page directive:<\/p>\n<pre name=\"code\" class=\"html\"><%@ Page Language=\"C#\" \r\nAutoEventWireup=\"true\" \r\nCodeBehind=\"Default.aspx.cs\" \r\nInherits=\"Chapter6.singlepagetheme.Default\" \r\nEnableTheming=\"false\" %><\/pre>\n<p>Run the page and <span style=\"color: red;\">notice how the theme is still applied to the page<\/span>, altho <strong>EnableTheming<\/strong> is set to <em>false<\/em>.<br \/>\nEither I&#8217;m doing something wrong but I seriously doubt that since I&#8217;m following the instructions in the book&#8230;<\/p>\n<p>Any thoughts \/ ideas?<\/p>\n<p><strong>* EDIT:<\/strong> The <em>EnableTheming<\/em> attribute on ASP.NET controls does work.<br \/>\n<strong>* EDIT 2:<\/strong> Following link takes you to the MSDN page on how to disable themes. Mind the &#8220;Community Content&#8221; comment: <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/kx3kzht7.aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/kx3kzht7.aspx<\/a><br \/>\n<strong>* EDIT 3:<\/strong><br \/>\n<figure id=\"attachment_721\" aria-describedby=\"caption-attachment-721\" style=\"width: 907px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/dirk.schuermans.me\/wp-content\/uploads\/2011\/09\/disable_theme_book_example.png\"><img loading=\"lazy\" src=\"http:\/\/dirk.schuermans.me\/wp-content\/uploads\/2011\/09\/disable_theme_book_example.png\" alt=\"\" title=\"Snippet from my book\" width=\"907\" height=\"189\" class=\"size-full wp-image-721\" srcset=\"https:\/\/dirk.schuermans.me\/wp-content\/uploads\/2011\/09\/disable_theme_book_example.png 907w, https:\/\/dirk.schuermans.me\/wp-content\/uploads\/2011\/09\/disable_theme_book_example-300x62.png 300w\" sizes=\"(max-width: 907px) 100vw, 907px\" \/><\/a><figcaption id=\"caption-attachment-721\" class=\"wp-caption-text\">Text snippet from my ASP.NET book<\/figcaption><\/figure><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey there! Today I was going over my &#8220;Themes and Skins&#8221; chapter in my ASP.NET 4 book and I noticed the following &#8220;bug&#8221;:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[38],"tags":[],"_links":{"self":[{"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=\/wp\/v2\/posts\/700"}],"collection":[{"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=700"}],"version-history":[{"count":24,"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=\/wp\/v2\/posts\/700\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=\/wp\/v2\/posts\/700\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dirk.schuermans.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}