Thursday, November 3, 2011

More quirks with ASP.NET MVC 3

So, another great quirk with ASP.NET MVC 3.  When you implement a controller with two methods, one being for the initial load of the page, and the other being for the subsequent form post to process the data... if your intention is to re-render the page to do another 'Add Item' scenario, you must issue a ModelState.Clear(); command before you render the new view... otherwise, it seems to keep the values from the posted data.

No comments: