ObjectDataSource and sorting
I struck this error today - "Automatic sorting is only supported with DataView, DataTable, and DataSet". It was caused by binding a custom collection through a DataSourceObject control.
Scott Guthrie suggests in a comment to this post to either implement a custom comparer, or make use of the SortParameterName property of the ObjectDataSource control.
I ended up doing the latter, as I need to be able to sort the collection on more than one property. My middle-tier expects this as an extra parameter, and then uses a DataView to sort the DataTable before it creates the custom collection.
Categories: .NET