We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ArrayList as a Datasource for GridDataBoundGrid

Hi Clay, Is it possible to have Arraylist as a Datasource for DataBound Grid. I dont find any reason for no as ArrayList Implements Ilist adapter. But, When I try to do that, the Grid is having only length of the values present in the Array. Thiagu.

7 Replies

AD Administrator Syncfusion Team October 26, 2004 09:45 AM UTC

You can have an ArrayList as a DataSource in a GridDataBoundGrid. The simplest way is to have the objects in the ArrayList have public properties with the values you want to see in the columns. Here is a little sample. GDBGArrayList_9458.zip


TH Thiyagu October 26, 2004 10:16 AM UTC

Thanks Clay. Thanks for your reply. >You can have an ArrayList as a DataSource in a GridDataBoundGrid. The simplest way is to have the objects in the ArrayList have public properties with the values you want to see in the columns. Here is a little sample. > >GDBGArrayList_9458.zip > >


TH Thiyagu October 27, 2004 03:26 AM UTC

Hi Clay, Is there anyway to specify the Order of the column explicitly??. As of now, the DataGrid is showing my Third column in the Array list as the First column in the Grid. Thanks in Advance, Thiagu >Thanks Clay. Thanks for your reply. > >>You can have an ArrayList as a DataSource in a GridDataBoundGrid. The simplest way is to have the objects in the ArrayList have public properties with the values you want to see in the columns. Here is a little sample. >> >>GDBGArrayList_9458.zip >> >>


AD Administrator Syncfusion Team October 27, 2004 04:22 AM UTC

To specify which columns you see and their order, you create GridBoundColumn objects for each column and add them to the grid.GridBoundColumns collection in the order you want them to appear.


TH Thiyagu October 27, 2004 05:24 AM UTC

I tried out. But its not working. It is displaying none. It will be helpful if you can post a Sample for this. Thiagu >To specify which columns you see and their order, you create GridBoundColumn objects for each column and add them to the grid.GridBoundColumns collection in the order you want them to appear. > >


AD Administrator Syncfusion Team October 27, 2004 06:29 AM UTC

There are 2 points to consider. 1) Make sure you set the gridBoundColumn.MappingName properly, it is case sensitive. 2) And if you add the GridBoundColumns after you set the DataSource to the grid, then you also have to call grid.Binder.InitializeColumns to make sure the grid uses the columns exclusively, and does not mixed them up with the default gridboundcolumns that were added when you set the datasource. GDBGArrayList_3275.zip


TH Thiyagu October 27, 2004 06:54 AM UTC

Thanks Clay. I missed out the Mapping name. Thanks a lot, Thiyagu.

Loader.
Live Chat Icon For mobile
Up arrow icon