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 Exclude from separate list

Sorting Ascending and Descending

Linq Query Syntax vs Method Syntax