木子屋 Dnawo's BLOG

ASP.NET MVC3视图占位符RenderSection使用示例

👤 dnawo 📅 2013-09-11 👁 4973 👍 0 💬 0 🔄 本站原创
Shared/MasterPage.cshtml:
<!DOCTYPE html>
<html>
<head>
    <title>@ViewBag.Title</title>
    @this.RenderSection("Head_Js", false)
</head>

<body>
    @this.RenderSection("Body_Content", true)
</body>
</html>

Home/Index.cshtml:
@{
    ViewBag.Title = "ASP.NET MVC3视图占位符RenderSection使用示例";
    Layout = "~/Views/Shared/MasterPage.cshtml";
}

@section Head_Js{
    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
}

@section Body_Content{
    <div id="msg"></div>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#msg").html("hello,section.");
        });
    </script>
}

图片

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 jQuery不同版本判断checkbox是否选中方法比较 下一篇 → ASP.NET MVC3接收参数小测试