0
votes

I have a kendo grid (asp mvc) where the fields have a client template such that if the numeric value to be displayed is null it should display N/A instead. I also have formatting specified so that numbers have comma thousands separators and two decimal places. However the client template removes the formatting. Is there a way to have both?

An example column from the grid:

columns.Bound(p => p.RangeMin).Title("Range Min").ClientTemplate("#= RangeMin == null ? 'N/A' : RangeMin #").Format("{0:#,###.00}");
1

1 Answers

1
votes

Instead of calling format after, call the kendo.toString method inside your ClientTemplate call, to avoid trying to format 'N/A' as a number:

columns.Bound(p => p.RangeMin).Title("Range Min").ClientTemplate("#= RangeMin == null ? 'N/A' : kendo.toString(RangeMin, '#,###.00') #");