• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

sorting a gridview using a objectdatasource which is linked to a list of objects

Hi all.
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?

1 Solution
You can sort a gridview using an objectDataSource but you'll have to write it.

Its not so bad to write, the best example i could find is here:

osionAuthor Commented:
Thanks amx,
That seems good.
All the best
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now