How to organized page specific CSS link tags with spark view pages and application.spark
Posted
by dbr
on Stack Overflow
See other posts from Stack Overflow
or by dbr
Published on 2010-03-12T14:21:05Z
Indexed on
2010/03/14
9:45 UTC
Read the original article
Hit count: 458
I'm currently using ASP.NET MVC 2 and the spark view engine. The main master page (application.spark) contains all of the CSS link tags that need to be present for all pages (global stuff). However, I have some content pages that have page specific CSS tags and currently I'm just sticking the link tag in the body as something like:
<content name="MainContent">
<!-- page specific csss -->
<link rel="stylesheet" href="/Content/css/page_specific.css" />
My problem is that when the page renders, this tag ends up in the which is not where it needs to be. Is there a solution for this?
One idea I had was to check the controller in the Application.spark page and write out which page specific css file is required for that particular controller, however, that solution doesn't seem to scale well and I would imagine there is some way of creating the link in the child page and having it render where it's supposed to by the browser.
© Stack Overflow or respective owner