How can I know if a non-required RenderSection exists?

后端 未结 1 914
夕颜
夕颜 2020-12-24 04:34
@* Omitted code.. *@
@RenderBody()
@RenderSection(\"Sidebar\", required: false)

Is there any way to know in the Omitted code part if t

1条回答
  •  执笔经年
    2020-12-24 04:51

    @if (IsSectionDefined("Sidebar"))
    {
        @RenderSection("Sidebar")
    }
    else
    {
        
    Some default content
    }

    0 讨论(0)
提交回复
热议问题