0

I currently have a grid with a column that has larger numbers (1000+).

My customer recently asked me to make that column have commas within those numbers. I know you can change the number into a string, however, I do some mathematical work as well with that column, so I would prefer not changing the number from an int to a string and then reverse it again.

The grid I'm using is a Telerik Extensions MVC grid.

Thanks.

IyaTaisho
  • 863
  • 19
  • 42

2 Answers2

1

You can use the Format() method, and pass your desired format to it. (but you have to test your format against the culture settings because formats are culture-dependent)

@(Html.Kendo().Grid<YourModel>().Name("YourGridName").Columns(columns =>
{
...
// this format puts group separator for large numbers
columns.Bound(p => p.LargeNumberField).Title("LargeNum").Format("{0:0,00}");
})
Ahmad Ibrahim
  • 1,915
  • 2
  • 15
  • 32
0

You can use Format("{0:N0}") only because I get error for negative number as my numbers are not always larger than 1000.

Warr's answer can be userful too. How to add in KendoUI MVC Grid a thousand comma separator

Community
  • 1
  • 1
bishnu karki
  • 129
  • 1
  • 5