Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-page wizard in MVC - where to store the entered data

What do you think it's the best way to create a wizard over several pages in asp.net-mvc ? I am thinking to:

  1. create a hidden field in every page which contain my whole object serialized
  2. override OnActionExecuting -> get my object from the hidden or tempdata
  3. override OnResultExecuted -> put the object in tempdata, when i go to the next page(when redirect)
like image 778
bogus Avatar asked Dec 16 '09 10:12

bogus


1 Answers

  1. Wrap each step in the wizard in some <form> element
  2. Do a form submit when going to the next step (either through javascript or via <input type='submit'>
  3. Handle the form-post to extract the data inserted by the user
  4. Store your previously stored answers in a Session variable, and retrieve the object when in the form-post
  5. Add the new answers, and re-save the object in Session
  6. When finishing, retrieve the object, and persist the settings.

Just have some

[Serializable]
public class WizardAnswers

which contains properties for each wizard-answer to save the user's data in.

like image 190
Jan Jongboom Avatar answered Oct 10 '22 01:10

Jan Jongboom