This is a migrated thread and some comments may be shown as answers.

Sorting a grid bound to a DataTable

2 Answers 127 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jose Simas
Top achievements
Rank 2
Jose Simas asked on 14 Jul 2011, 04:48 PM
Hi,


I have a DataTable with numeric data that is bound to a RadGridView. When I sort a column by clicking the grid's header it is sorted by that column which is correct. The problem is that the sort applied to the column is a string sort and I would like it to sort numerically. I looked in the grid documentation under Sorting to no avail. Could you please tell me how this is done?


Best Regards,
Jose

2 Answers, 1 is accepted

Sort by
0
Accepted
Milan
Telerik team
answered on 15 Jul 2011, 07:15 AM
Hi Jose Simas,

Well, if the data that is being sorted is of type string it is natural to get such sorting. The only way to get numeric sorting is to have numeric data. Please convert your string data to numeric format.

Kind regards,
Milan
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Jose Simas
Top achievements
Rank 2
answered on 15 Jul 2011, 10:01 AM
Hi Milan,

Thanks for that, it sent me on the right path, it is indeed my mistake as some of the columns of the DataTable were of type string instead of double.

Best Regards,
Jose
Tags
GridView
Asked by
Jose Simas
Top achievements
Rank 2
Answers by
Milan
Telerik team
Jose Simas
Top achievements
Rank 2
Share this question
or