I was working on some CSS based printing stuff today (inside an ASP.NET WebForms application) and I ran into an odd issue.
The application is making use of MasterPages and Themes, but I was working on a new page (a full blown .aspx) that was used exclusively for printing. This meant two things:
- I made sure to NOT use a MasterPage in the
@Page declaration. - I set
EnableTheming="false" in the @Page declaration.
With that done I should have had a page with zero style... that is, no stylesheets or inherited markup - essentially a blank slate. So I started adding content to the page and pretty soon I realized that the new page was in fact pulling down all of the stylesheets defined in the application's default theme.
When I say default theme I mean just that - a theme named Default as declared in the web.config:
<pages theme="Default" validateRequest="true"
smartNavigation="false" enableViewStateMac="false" >
My understanding is that by defining a theme in the web.config we don't need to explicitly define a theme in each page in the application. Is that correct?
Assuming it is, then I should be able to explicitly turn theming off for a given page by setting as mentioned in point #2 above, right? Am I just way off the mark here?
Argh!
I was about to start pulling my hair out, but luckily Phil was there (via Skype, naturally) to calm me down. He also suggested explicitly setting the new page to a non-default theme. So we did - and it worked!
So who out there can explain this to me? I'm probably missing something totally basic and obvious so be kind. :)