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

Sorting in RadGrid

3 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hamda
Top achievements
Rank 1
hamda asked on 22 Aug 2010, 05:50 AM
Hi all,

I'm trying to do sorting to a radgrid but it gives me this error: The datasource 'datasourcename' doesn't support sorting with IEnumerable data. I want to do sorting the moment the page loaded.

Regards,

_Hamda

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 23 Aug 2010, 12:28 PM
Hello Hamda,

The behavior you are observing is not directly related to our RadGrid control. Unfortunately it is the default behavior of ObjectDataSource, which, as the exception's message shows, cannot handle sorting on IEnumerable, but only on DataView, DataTable, and DataSet. However RadGrid does provide option to work-around this limitation of ObjectDataSource control, which you can enable by setting MasterTableView's OverrideDataSourceControlSorting to true.

Additional information regarding this issue you can find here:
http://www.telerik.com/help/aspnet-ajax/grderrormessages.html

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
hamda
Top achievements
Rank 1
answered on 25 Aug 2010, 05:39 AM
Thanks Pavlina! it solved half my problem. Is there a possible way to sort a radgrid column by 'the most recent', I want my column to show the last added item as the first item in the grid. Please help.

Thanks,
Hamda
0
Pavlina
Telerik team
answered on 25 Aug 2010, 10:31 AM
Hello Hamda,

You can skip this default sort behavior and provide your own custom sort order for a column by setting the AllowCustomSorting property of the corresponding table view. With custom sorting enabled, RadGrid displays the sorting icons but does not actually sort the data. Instead, you can perform the custom sorting inside the SortCommand event handler. Review the help article below for additional information:
http://www.telerik.com/help/aspnet-ajax/grdapplycustomsortcriteria.html

Regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
hamda
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
hamda
Top achievements
Rank 1
Share this question
or