Possible Duplicate:
How to reference a .css file on a razor view?
How to add page specfic css in asp.net mvc3 views but i dont want to add
css for page in header , is there any other solution ???
Possible Duplicate:
How to reference a .css file on a razor view?
How to add page specfic css in asp.net mvc3 views but i dont want to add
css for page in header , is there any other solution ???
You could define a section in your _Layout.cshtml
:
<head>
...
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
@RenderSection("styles", false)
...
</head>
and then inside your view override this section to include the specific CSS for the given view:
@section styles {
<link href="@Url.Content("~/Content/index.css")" rel="stylesheet" type="text/css" />
}
using jquery you can do it.
var cssselection;
if(x)
cssselection=default.css
else
cssselection=first.css
$(function() {
$('link').first().attr('href', cssselection);
});