asp.net mvc 3 razor sections and portable areas
Is it possible to have a portable area feed into a ASP.Net MVC 3 razor section? I have a section in my for placing JS files, CSS, fiels, etc. I want to be able to target the head section from portable area开发者_Go百科s for any JS, CSS files the portable area needs. Is this possible?
Thanks Tom
You can use master page concept just like _Layout.chtml to put portable sections. (It event works for header)
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet"
type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")"
type="text/javascript"> </script>
@{
//access your portable section here.
}
</head>
<body>
@RenderBody()
</body>
</html>
精彩评论