How to apply a Layout for a View in ASP.NET MVC ?

In the previous article , step by step procedure was provided on How to Create Layout in ASP.NET MVC Project ? . This article will explain how to apply a layout to a View in ASP.NET MVC.

How to apply a Layout for a View in ASP.NET MVC ?

The View has a property called “Layout” . This “Layout” property needs to be set in case the View needs to have a layout.

Below is a sample View where the Layout is setout for it.

@model AbundantCodeModel.Articles

@{

Layout = “~/Views/_Layout1.cshtml”;

}

Programming Article Title: @Model.Title