12

Disable Theming and StyleSheet theme for one specific page in Asp.Net 2.0

I recently started using the new Theming features of asp.net 2.0 and I have to say it works like a charm !
Just putting one line inside the Web.Config file to enable a theme and change the look of the complete website is just fabulous…

But what to do when you want to disable everything for one page ? I searched the internet for a solution but found none ( maybe I didn’t look very good ? ;) ) !

I know there are 2 page directives that help setting the themes, but to disable them I only found one !

<%@ Page Language="C#" Theme="OrangeTheme" StyleSheetTheme="GreenTheme" %>
<%@ Page Language="C#" EnableTheming="false" %>

But the EnableTheming will only effect the choosen theme and will not effect the StyleSheet theme !!

Even our friend the intellisence didn’t offer me any clues… When you type Theme=”, it will show you a list of available themes, so you can choose one from it.

So I was stuck and needed this feature for the default.aspx page of a small website I was building. But like many other solutions, this one also came by accident !

When I was trying every combination of theme and stylesheet, I just ( for the fun of it ) entered 2 empty string sequences, to see what the result would be… And tadaaaaa, what did I get, a default.aspx page ‘without a theme and stylesheet theme’ !!!

So people when you want NO theme and NO stylesheet theme just use following code :

<%@ Page Language="C#" Theme="" StyleSheetTheme="" %>

Depechie

12 Comments

  1. Thanks for this its been “wrecking my buzz” for a week.

  2. Oh my god……………………..

    WILL YOU MARRY ME?!?!?!?

    Damnit ASP.NET Themes!! They are truly a pain in the *ss!!
    It’s been a long fight, dont try to show an excel file or xml with themes activated inside web.config, they just ask for head=”server”, and since you only have the header inside the aspx page () it doesnt work.

    But now, it WORKS!!!!!!!!!!!
    Thank you a MILION! I owe you a beer at least! :D :D

  3. Thanks man for this
    I was trying to get rid of the stupid theme from a specified web page and I couldn’t find the way to do it.

    Thanks a million

  4. Thank you so much for this post. It would have taken me forever to stumble onto that.

  5. Saved the day, thank you so much. Best regards from Brasil.

Leave a Reply

Your email address will not be published. Required fields are marked *