What do you think it's the best way to create a wizard over several pages in asp.net-mvc ? I am thinking to:
- create a hidden field in every page which contain my whole object serialized
- override OnActionExecuting -> get my object from the hidden or tempdata
- override OnResultExecuted -> put the object in tempdata, when i go to the nex开发者_如何学JAVAt page(when redirect)
- Wrap each step in the wizard in some
<form>
element - Do a form submit when going to the next step (either through javascript or via
<input type='submit'>
- Handle the form-post to extract the data inserted by the user
- Store your previously stored answers in a
Session
variable, and retrieve the object when in the form-post - Add the new answers, and re-save the object in
Session
- 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.
精彩评论