We need to create a view for the home controller's Index
action in order to test our template. Complete the following steps to accomplish this:
Open the
HomeController.cs
file, right-click inside theIndex
method, and selectAdd View…
from the context-menu.In the Add View dialog, set the View name textbox to
Index
and the Template combobox to Empty (without model).Tick the Use a layout page checkbox, and select the
_Layout.cshtml
file we created earlier as the layout page. Click on Add.An
Index.cshtml
file will be created inside theViews\Home
folder.Add the following markup to the view:
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Blank</h1> </div> </div>
Run your project, and you should see the home view and layout in your browser. Note that the left-hand side menu will be expanded to display all items...