How to display back updated model object in C# .Net MVC ?
EditImage 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.further reading: ModelState.Clear() is required to display back your model object | Patrick Desjardins' Blog:
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.
How to display back updated model object in C# .Net MVC ?
Reviewed by DF
on
10:19:00 PM
Rating: