Hi all,
I have a RadGrid with autogenerated columns. Everything works fine, except for sorting numbers. The grid tries to sort the numbers as a string, instead of a number. So what I tried to do to get this working, and also be able to get Min/Max/Average/etc, was to change the datatype in the .cs file to Decimal.
Here is what that looks like:
protected void radGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e) { if (e.Column is GridBoundColumn) { if (e.Column.UniqueName == "Total") { GridBoundColumn col = e.Column as GridBoundColumn; col.DataType = typeof(decimal); col.DataFormatString = "${0:###.##}"; col.ItemStyle.HorizontalAlign = HorizontalAlign.Center; } } }
Now the problem that I am encountering is that the Grid looses all its functionality. I cannot sort any column, I cannot move/hide/filter columns, and I cannot group anything either.
All I see is the Update control spinning for a split second, then it does nothing.
My question is, is this the proper way to assign a datatype to the column (col.DataType = typeof(decimal);) or should be done some other way?
Thanks
