Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving a row from one datagrid to another datagrid

Status
Not open for further replies.

cazellnu

Technical User
Aug 15, 2002
41
CA
Hi all

I had being giving an assigment to constuct an application that involve two datagrid. To do that, I create a collection object call colObj and bind the datagrids with something similar to the following

colObj1.add(obj) or colObj2.remove(obj)
dg1.datasource=colObj1
dg1.databind()

colObj2.add(obj) or colObj2.remove(obj)
dg2.datasource = colObj2
dg2.databind()

Then I create a button column in each datagrid so user can select which row of datagrid to be move or remove. I am also using a event onSelectedIndexChanged to trigger the "moving" procedure. The challenge part is, how do i use the datakey to indicate which object I would like to add or remove from the collection according to which button user had click.

Any help or suggestion will be greatly help. Thank you
 
The following data sources are valid:
DataTable
DataView
DataSet
DataViewManager
Your "collection" component should implement the IListSource interface or the IList interface in order to work with a DataGrid.
You can also bind the DataGrid to an ArrayList but there some restrictions.
What you try to do could be achieved but I suggest to use or to derive from one of the above data sources, for instance , DataSet or DataViewManager.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top