section

时间:2024-12-23 20:34:20

@RenderSection("Header")

 

@section Header {
<div class="view">
@foreach (string str in new [] {"Home", "List", "Edit"}) {
@Html.ActionLink(str, str, null, new { style = "margin: 5px"
})

 

@RenderBody()==》@RenderSection("Body")==》@section Body

 

@if (IsSectionDefined("Footer")) {
@RenderSection("Footer")
} else {
<h4>This is the default footer</h4>
}

 

@RenderSection("scripts", false)             //如果不设定false,则必须提供相应的Section,否则抛出异常。