Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Best control to display an arraylist

2 views
Skip to first unread message

VT Venkatesh

unread,
Aug 6, 2008, 7:46:57 AM8/6/08
to
When i tried the following code (ie trying to bind a multicolumn
arraylist with a datagrid)
I get the error
'An invalid data source is being used for DataGrid1. A valid data source
must implement either IListSource or IEnumerable. '
Which is the way to display such an arraylist with a control like
gridview,dataGrid etc
venkatesh
************************************
Type
TGuitar =class
make:string ;
cost:string;
end;
var
g1:TGuitar;
guitarAL:ArrayList ;
begin;
guitarAL:=arrayList.create;
g1:=TGuitar.create;
g1.make:='1972';
g1.cost :='200' ;
guitarAL.add(g1);
g1:=TGuitar.create;
g1.make:='2000';
g1.cost :='200' ;
datagrid1.DataSource :=g1;
databind;
**************************************

Marc Rohloff [TeamB]

unread,
Aug 6, 2008, 9:49:27 AM8/6/08
to
On Wed, 06 Aug 2008 17:16:57 +0530, VT Venkatesh wrote:

> When i tried the following code (ie trying to bind a multicolumn
> arraylist with a datagrid)
> I get the error
> 'An invalid data source is being used for DataGrid1. A valid data source
> must implement either IListSource or IEnumerable. '
> Which is the way to display such an arraylist with a control like

You aren't binding to the arraylist you are trying to bind to TGuitar.

--
Marc Rohloff [TeamB]
marc -at- marc rohloff -dot- com

VT Venkatesh

unread,
Aug 6, 2008, 11:52:22 AM8/6/08
to
Marc Rohloff [TeamB] wrote:

>
> You aren't binding to the arraylist you are trying to bind to TGuitar.

Sorry.Thanks for pointing it out.When i try to bind a gridview it with
arraylist ,the error
is
***************************************
The data source for GridView with id 'gvGuitar' did not have any
properties or attributes from which to generate columns. Ensure that
your data source has contentraylist
*****************************************
I know one can use only single column arraylist with gridview.
How does one does with multicolumn arraylist.
I did read some thing about ObjectDataSource.How ever i could not get
any proper reference for delphi related stuff.
Any pointers?
Venatesh

VT Venkatesh

unread,
Aug 6, 2008, 1:23:21 PM8/6/08
to
VT Venkatesh wrote:
> Marc Rohloff [TeamB] wrote:
>
>>
>> You aren't binding to the arraylist you are trying to bind to TGuitar.
>
>
I converted it to delphi from
http://www.codeproject.com/KB/aspnet/GridViewObjectDataSource.aspx
It works great now
Venkatesh
0 new messages