How do you preserve the viewstate while using strongly typed views in asp MVC 2?

Posted by Mark Kadlec on Stack Overflow See other posts from Stack Overflow or by Mark Kadlec
Published on 2010-06-11T19:57:09Z Indexed on 2010/06/11 20:03 UTC
Read the original article Hit count: 188

Filed under:

I have an ActionResult returning from a strongly typed view where I manually validate some conditions, pass in an error message, but would like to preserve the users responses.

Since my View is strongly typed, I am calling it like this:

return View("PrincipalInvestigatorForm", new SmartFormViewModel(sections, questions));

My problem though, is that the error message is displayed but all the users data is wiped. How do I preserve the "ViewState" in MVC? Is there an easy way?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2