When I hit a breakpoint in the Update
method shown below, all of the properties of model
are populated with values that are not null. The user enters the values on the Index
view. They are seen in the Index
controller action method, and again in the Update
method after the redirect.
When I continue execution and the Update
view is displayed, I hit a breakpoint in the Update
view, and all of the properties of the model are null. When I try to display the values in the Update
view with @Html.DisplayFor()
or @(Model.Property)
, the values entered by the user are not seen in the page.
Is there any way to pass the model, with values intact, to the Update
view? Thanks.
[HttpPost]
public ActionResult Index(Models.MyModel model)
{
return RedirectToAction("Update");
}
[HttpGet]
public ActionResult Update(Models.MyModel model)
{
return View(model);
}