0

I post a model to this action:

public ActionResult Action(Detail Model)
{
    try
    {
        Model.db = db;
        Model.PerformAction();
        return PartialView("Detail", Model);
    }
    catch (Exception Exception)
    {
       ...
    }
}

in Model.PerformAction I change some property in the model. In the view detail a see the model updated, but, this is the point, if I do @Html.HiddenFor(m => m.SomePropertyChanged) the control is rendered with the old value (the one i posted to the action). What am I doing wrong?

  • 1
    If your changing a property value, then follow the PRG pattern and redirect (but you can use `ModelState.Clear()`) - the behavior is explained in [this answer](http://stackoverflow.com/questions/26654862/textboxfor-displaying-initial-value-not-the-value-updated-from-code/26664111#26664111)) –  Aug 03 '16 at 11:21
  • work like a charme, I think this question has to be marked as duplicate, I don't think I can do it, thanx – Massimiliano Carosi Aug 03 '16 at 11:27

0 Answers0