MVC 3 + Razor + Areas (Cannot call layout page)
Can any one had experience with MVC 3+ Razor + Areas?
I do not get the layout page when I access Areas view pages.. Can anyone help me in this?
I am good with routing and I can access view page inside Areas but it is not showing the ayout page (Masterpage)
Arul Kalivarathan, Jul 21, 2011
I added the _ViewStart.cshtml to the areas but the problem it is now causing me is that my page loads twice. So I have index method which gets called initially and populates a grid with a blank object.I also have Index with a parameter that gets called when a button is clicked. When I click the button the Index(int param) gets called but then the _ViewStart also appears to get called and loads the Index() method and clears out my data. If I remove the _Viewstart.cshtml it appears to work but now I have no formatting/layout to my page. I experienced this before and can't remember how I fixed it.
asp.net mvc 4
Dennis Tucker, Nov 21, 2012
Do as Dan suggests and also add your own _layout.cshtml file. If you have different Areas that will display content differently, it's good to have one _layout.cshtml for each Area.
Also, if you are using VS 2010, you should definitely make sure you are using the latest Tools Update for Visual Studio. This changes the "Add" dialogs to include many new features including HTML5 stuff.
I hope this helps.
King Wilder, Jul 24, 2011
Also, some good readings here...
Rajesh Pillai, Jul 23, 2011
Here is what you need: Include the _ViewStart.cshtml file in the Views folder for the Area.
In fact, if you have a global layout, you should add this file to each Area.
Hope this helps.
Dan McMillan, Jul 22, 2011