I have a ASP.NET MVC4 wizard. To pass one big viewmodel from step to step I use the futures assembly. I serialize my model with
@Html.Serialize("model", Model, SerializationMode.Signed);
and deserialize it in the controllers
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
var serialized = Request.Form["model"];
if (serialized != null)
{
model = (BausparViewModel)new MvcSerializer().Deserialize(serialized, SerializationMode.Signed);
TryUpdateModel(model);
}
...
}
I set the TempData in the
protected override void OnResultExecuted(ResultExecutedContext filterContext)
{
if (filterContext.Result is RedirectToRouteResult)
TempData["model"] = model;
}
Every wizard step has it's own view and I manage previous/next actions in the controller with RedirectToAction("ActionName")
Everything works fine, as long as the browser gets no refresh by using F5 or the menu. On this point the controller gets called again. The controller already has a model,although the TempData doesn't get saved again.
But there are two enum properties missing. They are used in previous steps. They got bound to the view via RadiobuttonFor.
So why is there a model which is incomplete?
Thanks in advance
csteinmueller