Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET default MVC4 application content pages without layout reference?

I created a mvc4 web app. with razor view engine. There are Layout page and content pages(Home, Contact, About, etc.) you know. But there is no reference to layout from content pages.

Should do not content pages include this:

Layout = "~/Views/Shared/_Layout.cshtml";

In content pages this code is missing.And they works. How does it do this without layout reference?

like image 379
AliRıza Adıyahşi Avatar asked Oct 09 '22 02:10

AliRıza Adıyahşi


1 Answers

It's because partial views are included into a 'non-partial' page, which does have a layout defined.. So they make use of that and just become a part of that page

EDIT

I'm sorry for the late reply, I just checked it out and it appears to be cause of the _ViewStart.cshtml page, this is a page that runs before any view is rendered, read more here:

weblogs.asp.net/gunnarpeipman/archive/2010/10/10/…

like image 60
Lauw Avatar answered Oct 12 '22 10:10

Lauw