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

Published on March 30, 2013 by abundantcode

Filed under ASP.NET

Last modified March 30, 2013

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 5 (1 votes)

This article have been viewed 3442 times

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

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

1 Comment

  1. Interesting .NET Links – March 31 , 3013 | TechBlog
    March 31, 2013 - 2:18 pm

Leave a Comment


x

You might be Interested in these Posts

How to return Json instead of XML in ASP.NET Web API ?

When you make a call to the ASP.NET Web API action method and notice this in Google Chrome browser ,...

How to Add Web API to existing ASP.NET Web Forms Project ?

In one of the previous posts , we saw how to add the WebAPI to the existing ASP.NET MVC project. Wel...

How to Add Web API to existing ASP.NET MVC Project ?

There are times when you might want to add Web API project to one of your existing ASP.NET MVC proje...