I have the following code in my _Layout:
@if (ViewBag.PageFormat == "Footer Buttons")
{
}
If I pass the “Footer Buttons” string in the viewbag then I would like to insert CSS code from an external file directly into the cshtml file. Something like an insert of the contents of an external file right into the cshtml file between the { and }.
Is there a way I can do this with MVC3?
If you mean load up CSS from an external file as inline CSS code, you should create an extension method on your HtmlHelper.
which you can call in your code like this: