Difference between Html.RenderBody() and Html.RenderSection() in ASP.NET MVC


The following table lists the differences between the RenderBody() and RenderSection() methods.

RenderBody() RenderSection()
The RenderBody() method must be present in the layout view. The RenderSection() method is optional.
RenderBody() renders all the content of the child view which is not wrapped in the named section. RenderSection() renders only a part of the child view which is wrapped under the named section.
Multiple RenderBody() methods are NOT allowed in a single layout view. Multiple RenderSection() methods are allowed in a single layout view.
The RenderBody() method does not include any parameter. The RenderSection() method includes boolean parameter "required", which makes the section optional or mandatory. If the required parameter is true, then the child view must contain the section.

Visit Layout View chapter for more information.