Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ignore viewstart in asp.net mvc razor views?

When I setup my site I didn't anticipate sections with completely different layouts, so I put the ViewStart page in the root of the Views folder. Reorganizing all the views is gonna be a huge pain.

Is there a way in specify in views to not inherit from the ViewStart page?

like image 272
chobo Avatar asked Sep 17 '11 21:09

chobo


1 Answers

First, take a look at this: How do I use a common _ViewStart in areas?. This will show you how to use different _ViewStart files for different areas.

You can also override the Layout in each View if you'd like by simply setting the value in the page:

@{
   Layout = "~/Views/Shared/NewLayout.cshtml";
}

Hope this helps.

like image 185
Garrett Vlieger Avatar answered Nov 09 '22 20:11

Garrett Vlieger