home / software / tips and tricks / In MVC, how to update the View after the post?

In MVC, how to update the View after the post?

Updated:  03/25/2016 14:03 PM
Author:  Shiju Mathews

Status:    Resolved.


When the form is posting to the controller method for Create or Update, this method is supposed to save the data to the database and then return as some updated values for the view. But if we are sending the updated model back to the view, the view will continue to show the old data.



Even though you are updating the model (car) with new data from database the view remains the same. This can be solved by explicitly calling the Clear() method of the ModelState as follows.



Tags: In MVC how to update the View after the post?
Updated on: November 2024