MVC4 – Layout

Now I show how can we use those sections in our views:
_Layout.cshtml

        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; @DateTime.Now.Year - My ASP.NET MVC Application</p>
                </div>
            </div>
        </footer>

        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)

Index.cshtml

    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "Index";
}

<h2>Index</h2>

@section featured{
    This is some feautured content
}

@section scripts{
    Some scripts
}

During web application development, we can use our custom layout which will include sections.
_LayoutWithSidebar.cshtml

@{
    ViewBag.Title = "_LayoutWithSidebar";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section Featured {
    @RenderSection("Featured", required: false)
}
@section Scripts {
    @RenderSection("Scripts", required: false)
}

<div class="sidebar">
    @RenderSection("sidebar")
</div>

<div class="content">
    @RenderBody()
</div>

Index.cshtml

@{
    Layout = "~/Views/Shared/_LayoutWithSidebar.cshtml";
    ViewBag.Title = "Auctions";
}

@section Sidebar {
    <h3>This is my sidebar!</h3>
}

@section Featured {
    <section class="featured">
        <div class="content-wrapper">
            This is some featured content!
        </div>
    </section>
}