In my MVC application (using Razor) i want avoid master page refresh every time that i click on a link.
My master page has this structure:
<html>
....
<div id="main">
@RenderBody()
</div>
...
</html>
Link buttons can be both in master page and in content page. How must be structured my pages?
Every time a view is retrieved using a standard call, master view is refreshed.
If you want to avoid this, you should create all your views using PartialViews, and do AJAX calls. So, when you click a link, an ajax call is performed, the partial view is retrieved and a DOM element (usually a div) is filled with the contents of partial view.
Doing this by hand is possible but you will have to face a lot of issues. If you really want to do a SPA (Single Page Application) start looking AngularJs, Durandal, Backbone or any Javascript library that help you on this! (ie take a look at http://www.codeproject.com/Articles/709766/Tutorial-for-Building-SPA-using-AngularJS ).
Finally, we decided to use an old and deprecated solution, but in my particular case (screen size fixed, no mobile, support just for ff) it works very good. I use iframe html tags: creating a custom starting web page that contains 3 different iframe that call their own function controller. I don't recommend it, but may be for someone can be useful, in case of emergency like mine..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.