I am working with master page in ASP.NET (3.5) MVC Framework (1.0). I am having one master page and 4 MVC Views in my application. I have placed these four views in the contentplaceholder of the master page. I have a Previous Button, a Next Button and the Submit Button in the master page.
Now the question is:
How to navigate between the 4 views using Previous and Next buttons. I.e. how to handle the button click event in MVC master page?
How to retain the values entered in each of the views while navigation, till I subm开发者_如何学编程it the data from all the 4 Views?
Use Session or hidden fields. This actually was answered on Stack Overflow, for example How do I create an ASP.NET MVC wizard with back button support?.
However, if you can use JavaScript, I'd suggest taking a look at:
http://home.aland.net/sundman/
or
http://www.sagecraft-studios.com/jquery/wizard-form-demo.html
It's a basis - for example, in second example you can do something like
show: function() {
prevPage.hide();
if (curPage.children().length == 0)
curPage.load("/form/wizard/ " + curPage.id);
}
That is, hide the previous page and show the next page, loading its content via Ajax only if not loaded.
精彩评论