Search code examples
c#asp.net-mvcwebformswizardformwizard

what is the best way to design a wizard form in ASP.NET MVC


i want to design a form in asp.net in Wizard style. do something in click next.

the form have 3 step

  1. fill your information

  2. add element [here if you type something wrong then you can edit or delete them before going to next step]

  3. finish

what is the best practise to design this in ASP.NET MVC with a power of ajax.

are anyone show me the best way i can use to do this in MVC


Solution

  • One of the ways that I have implemented a wizard is to have a separate database table that contains all of the information you are required to store and to save/retrieve data to that table in each step of your wizard - obviously depending on the size and purpose of the wizard this may not be sensible with the number of database calls but I was implementing only a 5 page wizard with maximum 5-10 fields on each page. So when you land on a page you query the database and retrieve the information from the database or if it doesn't exist load a blank page where the user can then enter the information and it is saved when they click either Next or Previous.

    For navigating between pages I simply built a helper class that accepted the page name and button type (Next/Previous) and had a simple switch statement which would return the page to navigate to and then used that in a RedirectToAction statement. Again this may not suit a larger application but you could also look at using Windows Workflow (touched on in this article http://www.devx.com/dotnet/Article/29992) as I know that it can be used to create wizard style applications.