开发者

Multi-Step Forms using MVC 3

开发者 https://www.devze.com 2023-03-25 00:02 出处:网络
I\'m creating a multi-step form in MVC3. Each step is a View, and I have a form on each one, with a hidden field to store the serialised model. The bel开发者_StackOverflow社区ow method is used to retr

I'm creating a multi-step form in MVC3. Each step is a View, and I have a form on each one, with a hidden field to store the serialised model. The bel开发者_StackOverflow社区ow method is used to retrieve the model from the hidden field between each step.

protected override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        _model = (SerializationUtils.Deserialize(Request.Form["model"]) ?? TempData["model"] ?? new Model()) as Model;
        TryUpdateModel(_model);
    }

My problem is that on one of the forms, I want to have a dialog, which allows the user to select items from a list. When the user closes the dialog, the values selected should populate stuff on the form. The dialog does not have the hidden field. So when I submit the dialog, the above code isn't executed as there is no field called 'model', meaning if I refresh the main form, the panel with the dialog results doesnt populate as the values aren't written onto the model.

Does anyone know how I can achieve this, using any approach?

0

精彩评论

暂无评论...
验证码 换一张
取 消