views:

1109

answers:

1

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 submit the data from all the 4 Views?

A: 

Use Session or hidden fields. This actually was answered on Stack Overflow, for example http://stackoverflow.com/questions/590613/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.

queen3