Defining layout.cshtml

Back to Contents

First of all, realise that you have a shared _Layout.cshtml file that is the parent page for all contained webpages. Layout.cshmtl is the only page that has a <head> section, so that’s where I added the CSS file and some Javascript files to include:
<meta charset=”utf-8″ />
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″ />
<link rel=”stylesheet” href=””>
<script src=””></script>
<script src=””></script>
<script src=”~/Scripts/jquery-1.10.2.min.js”></script>
<script src=”~/Scripts/angular.js”></script>
<script src=”~/Scripts/Planning.js”></script>

In the body of layout.cshtml you will have Razor syntax to call RenderBody and RenderSection. These statements enable you to host different pages within your master page. In the example below I commented out the bootstrap navigation bar, because it didn’t work properly, but as you can see, you can reference different child pages, in this case Planning and Beletmelding. Planning and Beletmelding are different action methods within your client-side MVC controller named the HomeController.


@*<div class=”navbar navbar-inverse navbar-fixed-top col-md-12″>
<div class=”container”>
<div class=”navbar-collapse collapse”>
<ul class=”nav navbar-nav”>
<li>@Html.ActionLink(“Planning”, “Planning”, “Home”)</li>
<li>@Html.ActionLink(“BeletMelding”, “BeletMelding”, “Home”)</li>

<div class=”container body-content col-md-12″>

@RenderSection(“scripts”, required: false)


Back to Contents