This is working, but how???
I have a controller action for a post:
[AcceptVerbs(HttpVerbs.Post )]
public ActionResult Edit(Person person)
{
bool i
I had some code in the 'postback' that would remove invalid promo-codes and capitalize the response. Even if you update the model with the new value it won't be displayed because the ModelState value takes precedence (as others have already answered).
<%= Html.TextBox("PromoCode", Model.PromoCodes) %>
But if you have a case where this was happening and you don't want the old value persisted you need to do this:
ModelState.Remove("PromoCode");
or explicitly set the new value into modelstate (probably the better approach) :
ModelState.SetModelValue("PromoCode",
new ValueProviderResult(newValue, newValue, CultureInfo.CurrentCulture));