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
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.
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
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