Asp.net-Mvc-3
Razor 中部分的預設內容
我想為一個部分設置一些預設內容,假設頁腳。我怎樣才能做到這一點。
另外,如果我想將部分視圖呈現為預設內容怎麼辦。
謝謝
Haacked 發表了關於此<http://haacked.com/archive/2011/03/05/defining-default-content-for-a-razor-layout-section.aspx>的部落格。
@RenderSection("nameOfSection", required: false) @if (!IsSectionDefined("nameOfSection")) { <div>Default section content</div> }