How to get Commas in your razor Html.TextBoxFor

There are so many ways to do this ... but depending on circumstances they don't always work.  The simplest way is to apply the format directly on the Textbox like this:

  @Html.TextBoxFor(model => item.Population, "{0:N0}",new {style = "width: 100px;"})

Comments

Popular posts from this blog

Linq - Data Entities - Records by Max Date with CASE

Return View of a model or an HttpStatusCode

Grouping with Data Entities