Disable Asp.Net 2.0 Theme at page level

G

Guest

I've created a theme Css for my Asp.net 2.0 web application. The web.config
Pages Theme key is set to the theme name. Everything seams to work fine
except for any page that I want to disable the master theme and apply another
stylesheet.css.

According to the documentation I've read. I should be able to disable the
theme by setting the "enabletheming" attribute on the aspx Page to false.
This doesn't seam to work. When I look at the source of the generated page I
can see the link to the new stylesheet that I want but just prior to the body
tag I also see a reference to asp.net theme stylesheet that I'm tring to
disable.

Is this a bug? I've tried everything I know of to disable the theme at the
page level.
 
C

Chris Fulstow

Hi,

I agree that EnableTheming="false" doesn't seem to work. Weird.
Try this instead:

protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "";
}

HTH,

Chris
 
G

Guest

Hi,

I have the same problem, so far I've tried the following with no luck:
-Added EnableTheming="false" to Page directive
-Added Theme="" to Page directive
-Added Page.Theme="" to Page_PreInit event

just to give you a little bit more context: I'm setting theming in
web.config using:
<pages styleSheetTheme="White"/>
is this a bug in the framework? is there a workaround this?

Thanks,
PJ
 
G

Guest

Thanks Chris
Sorry for the delay but I got involved with some other issues!

Your work-around solved my problem. I had not thought about just setting
the page.Theme propery to an empty string.

I normally do not have to use Page_PreInt but for those pages I want to
override the application Theme I just use your work-around.

Its to bad the EnableTheming="false" page directive does not work as the
documentation states.

Thanks again
 
Joined
Jul 21, 2008
Messages
1
Reaction score
0
Set both the theme and StylesheetTheme

It may not be enough to just set the Theme="" you may need to set
StylesheetTheme="".
 
Joined
Mar 10, 2009
Messages
1
Reaction score
0
Problem Solution

You should use <pages theme="White"> instead of <pages styleSheetTheme="White"> at web.config. Then you should also add:

protected void Page_PreInit(object sender, EventArgs e)
{
Page.Theme = "";
}
8)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top