In a ASP.Net MVC project, I’m using Razor built-in _layout.cshtml with a classic two columns layout with header and footer. The idea is to show my application views in the right column of the layout and have a consistent look for the whole site without duplicating code…
The problem is that each time I call a view and have it content rendered in my layout right column with @RenderBody(), the whole layout is refreshed. Is it normal behaviour?
Is there any built-in mecanism in this Razor’s layout concept to refresh only the rendered view content and not the whole site or do I have to make a jQuery Ajax call and make a div replacement with view content?
Thanks
Etienne
if you want to switch your content dinamically, you have to load data via ajax and then replace the right column of your site…Razor don’t have a “automatic mode” to do that. =P
I have some projects using this ‘approach’. I render my views as partials views (in controller) and then I get the html and put where I want.