source

필요하지 않은 렌더 섹션이 있는지 어떻게 알 수 있습니까?

ittop 2023. 5. 17. 23:26
반응형

필요하지 않은 렌더 섹션이 있는지 어떻게 알 수 있습니까?

@* Omitted code.. *@
@RenderBody()
@RenderSection("Sidebar", required: false)

당신을 알 수 있는 방법이 있습니까?Omitted code부분 if 렌더 섹션Sidebar존재하나 아닌가요?

@if (IsSectionDefined("Sidebar"))
{
    @RenderSection("Sidebar")
}
else
{
    <div>Some default content</div>
}

언급URL : https://stackoverflow.com/questions/6769336/how-can-i-know-if-a-non-required-rendersection-exists

반응형