Nested layouts for MVC5

前端 未结 2 1831
甜味超标
甜味超标 2021-02-05 10:27

I\'ve seen a few posts on this topic:

Razor Nested Layouts with Cascading Sections

MVC 3 - Nested layouts - sections don't render in Areas

And it alw

2条回答
  •  抹茶落季
    2021-02-05 11:28

    Not sure if you still need help, but I'll answer anyways.

    There RenderSection method takes the following parameters according to the MSDN Documentation:

    public HelperResult RenderSection( string name, bool required )

    Parameters
    name
         Type: System.String
         The section to render.
    required
         Type: System.Boolean
         true to specify that the section is required; otherwise, false.
    

    Change the call to:

    @RenderSection("breadcrumbs", false);

    If the section "required" parameter is false, it will not give an error if that section is not included by a view.

提交回复
热议问题