Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2010, 04:09 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default App_Themes stylesheets

I am working on a website and making use of the App_Themes folder to apply styles the website.

I had intended to have a separate stylesheet for ie because it doesn't support some of the newer CSS3 techniques that are available.

Normally I would apply this with a conditional comment and it would be fine however as I am using the themes folder the link to the stylesheet is generated automatically and it appears to happen right before the closing </head> tag. The trouble is my ie stylesheet (ie.css) is getting placed before my other stylesheet (screen.css) in the markup which means the ie styles are being overwritten and not applied.

Is there a way to control the order in which the stylesheets are rendered in the markup?

I suspect that they are placed in alphabetical order so I am hoping for a way that doesn't involve re-naming the stylesheets if possible.

Cheers
__________________
Follow me on twitter.

Where I work.

Connect with me on LinkedIn

Blog
 
Old August 19th, 2010, 01:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Yes, AFAIK, it's in alphabetical order. You could indeed rename them (and let the names start with a number for example).
Alternatively, you could manaully include that CSS file in a master page, or use a CSS include to load it from another CSS file.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old August 19th, 2010, 02:33 PM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 194
Thanks: 5
Thanked 3 Times in 3 Posts
Default

I figured out my problem and your solution works. I looked at the source code and noticed that I had a link to the same stylesheet twice.. Turns out that in the web.config I had set both the Theme and styleSheetTheme of the <pages /> tag which meant that it was applying the same styles twice.

This meant my previous attempts at adding a conditional comment to the masterpage were failing because the Theme attribute sets the style late in the page life cycle. To fix this I am just using the styleSheetTheme attribute which allows for overriding of it's because it occurs relatively early in the page life cycle which is perfect for what I need.

Thanks for the help.
__________________
Follow me on twitter.

Where I work.

Connect with me on LinkedIn

Blog
 
Old August 20th, 2010, 02:07 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, that's how they are designed. The styleSheetTheme is meant to supply defaults, while theme is designed to change the design of (mostly existing) sites after everything else, to enforce a global look and feel.

I think your solution makes perfect sense.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing variables from parent stylesheets in included stylesheets apollo13 XSLT 2 March 31st, 2010 03:30 AM
How to reference a pic from app_themes to control chrizzz ASP.NET 2.0 Basics 0 July 18th, 2006 04:17 AM
Changing StyleSheets [email protected] Javascript How-To 2 May 18th, 2004 03:40 PM
CSS Stylesheets Lucy Dreamweaver (all versions) 4 November 4th, 2003 04:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.