title: Limit to 2 decimals in TextBoxFor
body: <p>The code below works fine but, in the textbox the decimal value has this format "0,0000" 
  (, is the decimal separator). I'd like have only 2 decimal. How can I do this ?</p>
  
  <p>Thanks,</p>
  
  <pre><code>//Database model used with NHibernate
  public class Bank
  {
      public virtual int Id { get; set; }
      public virtual string FirstName { get; set; }
      public virtual string LastName{ get; set; }
      public virtual decimal Amount { get; set; }
  }
  
  //MVC Model
  public class MyModel
  {
      public Bank Bank { get; set; }  
  }
  
  //View
  @Html.TextBoxFor(m =&gt; m.Bank.Amount, new { id = "tbAmount"}) 
  </code></pre>
  
  <h2>Update 1</h2>
  
  <p>In the debugger, I don't see any decimal, wehn I do step by step inside (o @HTML.Textbofor) the view, the value does not have any decimal but when the page is displayed there are 4 decimals</p>
  
  <pre><code>//Database model used with NHibernate
  public class Bank
  {
      public virtual int Id { get; set; }
      public virtual string FirstName { get; set; }
      public virtual string LastName{ get; set; }
      public virtual decimal Amount { get; set; }
  }
  
  //Class for view
  public class ViewBank
  {
      [DisplayFormat(DataFormatString = "{0:n2}", ApplyFormatInEditMode = true)]
      public decimal Amount { get; set; }
  }
  
  //MVC Model
  public class MyModel
  {
      public Bank Bank { get; set; }      
      var ViewBank = new ViewBank() { Amount = Bank.Amount};
  }
  
  //View
  @Html.TextBoxFor(m =&gt; m.Amount, new { id = "tbAmount"}) 
  </code></pre>