How can I know if a non-required RenderSection exists?
12,375
@if (IsSectionDefined("Sidebar"))
{
@RenderSection("Sidebar")
}
else
{
<div>Some default content</div>
}
Author by
Andreas Bonini
Updated on June 20, 2022Comments
-
Andreas Bonini almost 2 years
@* Omitted code.. *@ @RenderBody() @RenderSection("Sidebar", required: false)
Is there any way to know in the
Omitted code
part if the RenderSectionSidebar
exists or not?