<!DOCTYPE html>//布局页
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/bootstrap.min.css")" rel="stylesheet" />
</head>
<body>
@{Html.RenderPartial("_HeadPartial", 1);} //Html.RenderPartial()、Html.RenderPartial()、RenderPage()方法来显示分布页
@Html.Partial("_HeadPartial", 1)
@RenderPage("_FootPartial.cshtml")
<div>
@RenderBody()//RenderBody()方法来显示视图页
@RenderSection("SectionContent",required:false);//RenderSection()方法在分布页中提供占位符
@section SectionContent{ //占位符
<script type="text/javascript">
alert("弹出信息!")
</script>
}
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="@Url.Content("~/Scripts/bootstrap.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")"></script>
</body>
</html>
C# MVC模板试图
最新推荐文章于 2024-05-28 15:35:54 发布