巧用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> 

} 

 

你可能感兴趣的:(asp.net)