Data Annotation for currency format not working
<p>In my ASP.NET <code>MVC Core</code> web project on <code>VS2015</code>, the following model is displaying data as, e.g., 15481 instead of $15,481 even though I'm using <code>[DisplayFormat]</code> below:</p>

<p><strong>Models</strong>:</p>

<pre><code>public class State
{
    [Key]
    public int StateId { get; set; }

    [Column(TypeName ="varchar(40)")]
    public string StateName { get; set; }

    [Column(TypeName = "char(2)")]
    public string StateCode { get; set; }
}

public class Sales
{
    [Key]
    public int SalesId { get; set; }
    public int? FiscalYear { get; set; }

    [DisplayFormat(DataFormatString = "{(0:C0)}")]
    public float? SaleAmount { get; set; }

    public int StateId { get; set; }
    public State State { get; set; }
}
</code></pre>

<p><strong>ModelView</strong>:</p>

<pre><code>public class StatesSalesViewModel
{
    [HiddenInput]
    public int StateId { get; set; }

    [Display(Name ="State")]
    public string StateName { get; set; }
    public int? FiscalYear { get; set; }

    [DisplayFormat(DataFormatString = "{(0:C0)}")]
    public float? SaleAmount { get; set; }
}
</code></pre>

<p><strong>Controller</strong>:</p>

<pre><code>public async Task&lt;IActionResult&gt; FYSales(List&lt;StatesSalesViewModel&gt; model, string GO, int currentlySelectedIndex, string returnUrl = null)
{
    ViewData["ReturnUrl"] = returnUrl;
    ViewBag.YearsList = Enumerable.Range(1996, 29).Select(g =&gt; new SelectListItem { Value = g.ToString(), Text = g.ToString() }).ToList();

    if (!string.IsNullOrEmpty(GO))
    {
        var qryVM = from s in _context.States
                    join g in _context.Sales on s.StateId equals g.StateId
                    where g.FiscalYear == currentlySelectedIndex
                    select new StatesSalesViewModel() {StateId = s.StateId, StateName = s.StateName, SaleAmount = g.SaleAmount , FiscalYear = currentlySelectedIndex };

        return View(qryVM.ToList());
    }
}
</code></pre>

<p><strong>View</strong>:</p>

<pre><code>@model IList&lt;mProject.Models.StatesSalesViewModel&gt;

&lt;div class="row"&gt;
    &lt;div class="col-md-12"&gt;
        &lt;form asp-controller="StatesSales" asp-action="getSales" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post"&gt;
            @{
                IEnumerable&lt;SelectListItem&gt; yearsList = (IEnumerable&lt;SelectListItem&gt;)ViewBag.YearsList;
                var currentlySelectedIndex = 0; // Currently selected index (usually will come from model)
            }
            &lt;strong&gt;Select a Post Year&lt;/strong&gt;
            &lt;h6&gt;Choose a year o begin:&lt;/h6&gt;
            &lt;label&gt;Year:&lt;/label&gt;&lt;select asp-for="@currentlySelectedIndex" asp-items="yearsList"&gt;&lt;/select&gt;&lt;input type="submit" class="btn btn-default" name="GO" value="GO" /&gt;
            &lt;table class="table"&gt;
                &lt;thead&gt;
                    &lt;tr&gt;
                        &lt;th&gt;&lt;/th&gt;
                        &lt;th&gt;&lt;/th&gt;
                        &lt;th&gt;Fiscal Year&lt;/th&gt;
                        &lt;th&gt;State&lt;/th&gt;
                        &lt;th&gt;Sales&lt;/th&gt;
                    &lt;/tr&gt;
                &lt;/thead&gt;
                &lt;tbody&gt;
                    @for (int i=0; i&lt; Model.Count(); i++)
                    {
                        &lt;tr&gt;
                            &lt;td&gt;@Html.HiddenFor(r =&gt; r[i].StateID)&lt;/td&gt;
                            &lt;td&gt;@Html.HiddenFor(r =&gt; r[i].FYSalesID)&lt;/td&gt;
                            &lt;td&gt;
                                @Html.TextBoxFor(r =&gt; r[i].FiscalYear)
                            &lt;/td&gt;
                            &lt;td&gt;
                                @Html.TextBoxFor(r =&gt; r[i].StateName)
                            &lt;/td&gt;
                            &lt;td&gt;
                                @Html.TextBoxFor(r =&gt; r[i].SaleAmount)
                            &lt;/td&gt;
                        &lt;/tr&gt;
                    }
                &lt;/tbody&gt;
            &lt;/table&gt;
            &lt;button type="submit" class="btn btn-default"&gt;Save&lt;/button&gt;
        &lt;/form&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>