title: MVC2 TextBoxFor value not updating after submit?
body: <p>This is a really strange behavior, and I've set up some demo code to try to figure out what's going on.</p>
  
  <p>Basically have a a two actions and a single view. The first action sends an empty model to the view, the section action recieves the model, alters its contents and sends it back to the same view.</p>
  
  <p>The wierdness is, in the view, the Model seems to have the updated values in it, but when I do an Html.TextBoxFor(x => x.PropertyNameHere) it renders a textbox with the unaltered value in it.</p>
  
  <p>lol... I apologize in advance for the toilet humor, but it keeps the day from getting too boring. ;)</p>
  
  <p><strong>Does anyone have any idea what's going on here? Why is the output of TextBoxFor putting the old value in the value attribute?</strong></p>
  
  <p>Here's the code to replicate:</p>
  
  <p>/Views/Demo/Index.aspx</p>
  
  <pre><code>&lt;%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage&lt;TestWeb.DemoModel&gt;" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;Demo&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div&gt;
        &lt;%using (Html.BeginForm("DemoSubmit", "Admin", FormMethod.Post)) { %&gt;
          Foo: &lt;%=Html.TextBoxFor(x =&gt; x.Foo)%&gt; &lt;%:Model.Foo %&gt;&lt;br /&gt;
          Bar: &lt;%=Html.TextBoxFor(x =&gt; x.Bar) %&gt; &lt;%:Model.Bar %&gt;&lt;br /&gt;
          PoopSmith: &lt;%=Html.TextBoxFor(x =&gt; x.PoopSmith) %&gt; &lt;%:Model.PoopSmith %&gt;&lt;br /&gt;
          &lt;button type="submit"&gt;Submit&lt;/button&gt;
        &lt;%} %&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>DemoModel.cs</p>
  
  <pre><code>namespace TestWeb {
      public class DemoModel {
          public string Foo { get; set; }
          public int Bar { get; set; }
          public string PoopSmith { get; set; }
      }
  }
  </code></pre>
  
  <p>DemoController.cs</p>
  
  <pre><code>public class AdminController : Controller {
  
          public ActionResult Index() {
              var m = new DemoModel();
              return View(m);
          }
  
          public ActionResult DemoSubmit(DemoModel demo) {
              demo.Foo += "!!!";
              demo.Bar++;
              demo.PoopSmith += " has pooped.";
              return View("Index", demo);
          }
  }
  </code></pre>
  
  <p>And here's the bizarre output:</p>
  
  <p><a href="https://i.stack.imgur.com/90NEb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/90NEb.png" alt="Bizarre"></a>
  </p>