-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Old bug still in new MVC - POST AJAX show old data #4486
Comments
This is not a bug, but a side effect of a feature.
User enters Generally you shouldn't change model by yourself in postbacks and if you absolutely have to, you must also to update |
Thank You very much for your explanation.I will use clearing of modelstate in my scenario... |
Yup, what @Kukkimonsuta is the reason. |
I fail to understand why folks can't grok this. On a successful POST, redirect!! It's pretty standard practise and avoids the browser replay problems with forms (which is kinda 'web-101'). This SO question just goes to show how frustrating this 'issue' is to many developers, when if they'd just stop returning |
Hi,
I have ajax call from my view to controller for data update in PartialView.
Ajax call have disabled cache for this post action.
In controller is model changed properly (I see it in debug mode), but PartialView show me still after ajax return old data.
It is exactly the same scenario like here on StackOverflow:
http://stackoverflow.com/questions/1775170/asp-net-mvc-modelstate-clear
It is possible to solve this problem via using command: ModelState.Clear() in controller like in older MVC versions.
But i do not understand why work this so surprisingly...
Thank you
Miroslav
The text was updated successfully, but these errors were encountered: