How to display back updated model object in C# .Net MVC ?

Edit
Image Credit : http://ithelp.ithome.com.tw/question/10161697


Got stuck with the issue of the browser didn't get the update value from user input and after 2 hours of trial and error and search, finally i found the answer !
If you are getting your Model from a form and you want to manipulate the data that came from the client form and write it back to a view, you need to call ModelState.Clear() to clean the ModelState values.

The reason is that normally, you want to postback to the client the form with all the errors. So, when you put back the parameter that contain your model to the view to be returned, this one use the value of the ModelState.
further reading: ModelState.Clear() is required to display back your model object | Patrick Desjardins' Blog:
How to display back updated model object in C# .Net MVC ? How to display back updated model object in C# .Net MVC ? Reviewed by DF on 10:19:00 PM Rating: 5
©DF. Powered by Blogger.