Populate a datagrid

G

Guest

Was wondering if it is possible to take the contents of a row in a datagrid
and use an event to copy over the details of the selected row into another
datagrid. I'd like to be able to do the following: -

I have a datagrid on my page which comes back as follows. The addresses are
in a column which is databound. I would like to create an event on the
on-click of the select link (located in the datagrid). On this event I would
like to add the selected row to my arraylist address and then add them to the
2nd Datagrid.
Is this possible and if so could someone please show me where abouts I put
the code to do this and also how populate the second datagrid. Thanks for any
help you can give me.

DATAGRID1
Address
Databound Select
Databound Select
Databound Select

DATAGRID2
Address1 Address2 Address3 Address4 Address5
Arrayitem Arrayitem Arrayitem Arrayitem Arrayitem
etc, etc....
 
G

Guest

hi stephen.....

the best way my mind thinks in this situation is to have a dataset with a
column to hold a numeric value, which can be the key field.
bind the datagrid to the dataset, have the keyfield in the datagrid as a
hidden column or make its width to 0 pixels.

when u click a row in the datagrid u can get the selected row and the value
of the first cell which in your case is the key field,
now with this fieldas the key element, find the row that matches in the
dataset.

Ex.: dataset.Select("keyfield = " + keyfield);
this returns a datarow collection, assign the datarow to another dataset,
bind that dataset to the second grid that u might need....

a little amount of googling might help you in using the select function and
other code pieces you might need in building your requirements.......

i have given a brief idea on reading the selected text from cell 0 from a
datagrid in my reply to a previous post by you....

Hope this helps...
Regds,
http://kannanv.blogspot.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top