title: Formatting a TextBoxFor from Decimal to Dollar Amount
body: <p>I have an amount field that I am pre populating. When I run the web app, it comes out as 125.4500. I tried to format it but I've had no luck.</p>
  
  <p>Here is my PaymentModel:</p>
  
  <pre><code>  [Required]
    [DataType(DataType.Currency)]
    [DisplayFormat(DataFormatString = "{0:F2}", ApplyFormatInEditMode = true)]
    [Display(Name = "Payment Amount")]
    public decimal Amount { get; set; }
  </code></pre>
  
  <p>The <code>DataFormatString</code> seems to have no affect.</p>
  
  <p>And my code on the form:</p>
  
  <pre><code>@Html.TextBoxFor(m =&gt; m.Amount, new { @class = "makePaymentTextRight width90" })
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>@Html.TextBoxFor(m =&gt; string.Format("{0:F2}",m.Amount), new { @class = "makePaymentTextRight width90" })
  </code></pre>
  
  <p>But that gave me this error:</p>
  
  <blockquote>
    <p>System.InvalidOperationException: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.</p>
  </blockquote>
  
  <p>How do I get this to format to 2 decimal places?</p>