I am using an AJAX form post to send some form fields to the server, where the data will be updated in the database, and is massaged in the process, so the data may change a bit on the server side. The response of this controller's action is a partial that updates the form field's HTML so that the values of those fields include the new massaged values.
The trouble is, apparently some MVC .js must be executing on the returned partial's HTML to change the value of the text fields back to their originally posted values, so that the massaged values never show up.
I can see how this might be useful in some scenarios, but it's defeating my scenario. How do I suppress this behavior?
EDIT I've discovered that if in my partial I replace this:
<%= Html.TextBox("FirstName", Model.FirstName) %>
with this:
<input name="FirstName" value="<%= Html.Encode(Model.FirstName) %>" />
that the value in the form field updates as I would expect. So it seems there's some magical side-effects of Html.TextBox
that I don't yet understand.