[asp.net core]ASP.NET MVC3视图占位符RenderSection使用示例

时间:2019-01-07  来源:ASP.NET MVC  阅读:

hared/MasterPage.cshtml:

 代码如下





    @ViewBag.Title
    @this.RenderSection("Head_Js", false)


    @this.RenderSection("Body_Content", true)

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{
   
    <script type="text/javascript">
        $(document).ready(function () {
            $("#msg").html("hello,section.");
        });
    </script>
}

[asp.net core]ASP.NET MVC3视图占位符RenderSection使用示例

http://m.bbyears.com/asp/47106.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新