How can I know if a non-required RenderSection exists?
@* Omitted code.. *@
@RenderBody()
@RenderSection("Sidebar", required: false)
Is there any way to know in the Omitted code
part if the RenderSection Sid开发者_StackOverflowebar
exists or not?
@if (IsSectionDefined("Sidebar"))
{
@RenderSection("Sidebar")
}
else
{
<div>Some default content</div>
}
精彩评论