2.0 Generic Collection & ObjectDataSource

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is what I want and I can't seem to find it:

In asp.net 2.0 I want to create a generic collection that will perform
sorting and is capable of being used by the ObjectDataSource and eventually
bind to a GridView.

Are there any samples out there of this?
 
Demetri,

Why not derive from List<T>? You can add a method to sort the items,
and then the items should be able to be passed to an ObjectDataSource
easily.

Hope this helps.
 
Demetri said:
Here is what I want and I can't seem to find it:

In asp.net 2.0 I want to create a generic collection that will
perform sorting and is capable of being used by the ObjectDataSource
and eventually bind to a GridView.

Are there any samples out there of this?

ObjectDataSource expects an object which exposes 4 methods: Select,
Update, Insert and Delete (or methods which perform these actions). So,
create _that_ object first, and let the Select method return the
collection you want to bind/sort. That then will allow you to bind the
actually collection at design time.

See also:
http://www.nikhilk.net/DataSourceControlsDesignTime.aspx (part 5,
there are 4 other parts at that site, please read them all for more
information :))

Frans

--
 
Back
Top