ASP.NET MVC RenderSection

This post is as much for my own use as others as I’m always¬†forgetting how to add sections to an mvc masterpage.

In the master page add your subsection using:


and in the views implement this section using:

@section Footer {
<p>This is my footer</p>

You can make the section optional in your view:

<footer>@RenderSection(“Footer”, required: false)</footer>

Leave a Reply

Your email address will not be published. Required fields are marked *