When I setup my site I didn't anticip开发者_StackOverflow社区ate 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?
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.
No idea what pain you are talking about but that's the whole point of the _ViewStart.cshtml
file: place one in some root view folder and all vies automatically inherit from it and AFAIK there is no way to tell some views not to use it.
精彩评论