title: Textbox for Decimal value null when submitting form in ASP.Net?
body: <p>Textbox value when submitting the form is null in the controller.  Simplified structure of what I have is below:</p>
  
  <p><strong>MODEL</strong></p>
  
  <pre><code>public class MyObject
  {
      public decimal? DecimalProperty { get; set; }
  }
  </code></pre>
  
  <p><strong>VIEW</strong></p>
  
  <pre><code>@model List&lt;MyObject&gt;
  
  @for(var i = 0; i &lt; Model.Count; i++) 
  {
     using (Html.BeginForm("UpdateObject", "MyController", FormMethod.Post))
     {
        @Html.Textbox(String.Format("Model[{0}].DecimalProperty", i), Model[i].DecimalProperty)
        &lt;input type="submit" value="Update"/&gt;
     }
  }
  </code></pre>
  
  <p><strong>CONTROLLER</strong></p>
  
  <pre><code>public ActionResult UpdateObject(MyObject myObject)
  {
     // Do Stuff...
  }
  </code></pre>
  
  <p>If I put a breakpoint in the controller method, then check the property values of myObject, the DecimalProperty is null.  There are other properties on the actual object I'm using and those come across alright, but for some reason this property isn't.  I haven't found anything that suggests that decimals must be handled differently than a DateTime or string.  I have also tried writing out the html for the input by hand:</p>
  
  <pre><code> &lt;input type="text" name="@(String.Format("Model[{0}].DecimalProperty", i))" value="@Model[i].DecimalProperty" /&gt;
  </code></pre>
  
  <p>I have set the <em>name</em> and the <em>id</em> attributes of the textbox just to be on the safe side.  Any ideas as to why my textbox value is null when I submit the form?  </p>
  
  <p>Setting the [HttpPost] attribute does not help.</p>