巧用section在cshtml写入layout中写入head信息 ASP.NET MVC

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> 
} 

 

posted @ 2012-05-08 11:04  阿旭^_^  阅读(2672)  评论(0)    收藏  举报