views:

39

answers:

2

I know all the data source controls like LinqDataSource, ObjectDataSource etc.

They are cool but they are intended to be used in conjunction with a database.

I actually need a simple data source control that can work with a plain old List (That supports delete, update, select, insert ofcourse).

I was thinking of using the objectdatasource but the select, update... methods are not present in the List.

So is there such a control or do i have to roll my own? Should i inherit from the objectdatasource?

+1  A: 

The easiest thing to do would be to create a class that contains an instance of your list as well as methods for Selecting, Updating, Inserting, and Deleting from the list it contains. Then you can use the ObjectDataSource for databinding.

Jimmie R. Houts
Make sure you uncheck 'Show Only Data components' so you can see your class when configuring via the smart tag.
BigChrisDiD
I want to have a control that works with a list out of the box. I have several different lists i cant make select, delete commands for all of them.
diamandiev
The class you create could be generic so that you could specify the type of List that it contains.
Jimmie R. Houts
Ugh... I was going to give you a sample generic class for this, but it would be more complex than just binding to the List directly and handling the Update, Delete, and Insert commands as needed.
Jimmie R. Houts
A: 

I made the control I was talking about. I created a custom control inheriting from ObjectDataSource and then added a property which sets a Static/Shared list as a internal datasource. It works quite nice. If someone's interested contact me.

diamandiev