sorting a gridview using a objectdatasource which is linked to a list of objects
Posted on 2008-11-14
Well Im going round in circles a bit here.
Im having problems trying to implement sorting with a gridview using an ObjectDataSource.
The ObjectDataSource is linked to a method which returns a list of objects.
The query in the method actually returns a DataSet but I am manually looping through the rows in the DataTable and creating objects sticking them in a list. This way the gridview knows the type of object its getting back and I get all the columns shown in the interface and can use the smart tag to setup the gridview.
This is all great until I have to implement sorting. Since its a list it doesnt support list but it says DataSet does. So I tried linking the object data source directly to the DataSet and even the DataTable but not only do i loose the columns sorting doesnt work.
So my question is really:
1) Is it not possible to sort gridviews with ObjectDataSources?
2) Is there no way just to link the gridview to a dataset and get all the nice smart tag features and columns setup for you?