title: .NET MVC Ajax Form keeps old input values - how to update to the model's value?
body: <p>I have a properly working ajax form in my MVC3 application except for one caveat.  After I submit the form and get the result, even though the passed in model has a different value for the input (Amount in the example below) the old value still shows up on the screen.  I attribute this to the value being saved in the DOM and overriding/preventing the new value from the model.  There are various ways to fix this by running a javascript function on one of the form events.</p>
  
  <p>I would like to get feedback on what is the best way to handle this situation, preferably native to MVC and without javascript.  Here are the code snippets:</p>
  
  <h2>Parent View:</h2>
  
  <pre><code>&lt;div id="MyContainder"&gt;
      @Html.Partial("MyPartialView", ClassContainingAmountProperty)
  &lt;/div&gt;
  </code></pre>
  
  <h2>Partial View:</h2>
  
  <pre><code>@using (Ajax.BeginForm(actionName: "myaction",
                ajaxOptions: new AjaxOptions() UpdateTargetId = "MyContainder"})
        @Html.EditorFor(x =&gt; x.Amount)
        &lt;input type="submit" value="Save" /&gt;
  )
  </code></pre>
  
  <h2>Controller</h2>
  
  <pre><code>myModel.Amount = SomeNewNumber;
  return PartialView(myModel); //same partial view returned but with new amount
  </code></pre>