Difference between RenderBody and RenderSection in ASP.NET MVC:
The following table lists the difference between RenderBody() and RenderSection() methods.
RenderBody() | RenderSection() |
---|---|
RenderBody must be present in the layout view. | RenderSection method is optional. |
RenderBody renders all the content of child view which is not wrapped in named section. | RenderSection renders only a part child view that is wrapped under named section. |
Multiple RenderBody() method is NOT allowed in a single layout view. | Multiple RenderSection() method is allowed in a single layout view. |
RenderBody() method does not include any parameter. | RenderSection() method includes boolean parameter "required" which makes the section optional or mandatory. If required parameter is true then the child view must contain the section. |