By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,543 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,543 IT Pros & Developers. It's quick & easy.

Populate a datagrid

P: n/a
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....
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

"Stephen" wrote:
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....

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.