巧用section在cshtml写入layout中写入head信息 ASP.NET MVC
转自:http://www.cnblogs.com/a-xu/archive/2012/05/08/2489746.html
layout文件中:
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
@RenderSection("head", false)
</head>
cshtml模板文件中:
@section head
{
<script type="text/javascript"">
//Your java script here
</script>
}
是不是就是将脚本或样式表添加到布局页面的head 部分的意思??

浙公网安备 33010602011771号