473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Populate a datagrid

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
1 1842
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
4
by: Mike L | last post by:
I'm open for any suggestions on how to better program this. I want the user to select a license from a combo box, cboPrivilege and then the user will click the add button, then a record will be...
1
by: Mike | last post by:
I have to populate a list box from a db table and when the user clicks on the value in the listbox I need to then populate a datagrid with detailed information for the highlighted row. How can i...
3
by: crjunk | last post by:
I have 4 different databases that I'm having to pull data from in order to populate a datagrid. I am able to do this, but my problem is that because I'm pulling the data from 4 different...
1
by: Stephen | last post by:
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...
1
by: Mike P | last post by:
Is it possible when populating a datagrid to populate a dropdownlist column based upon the value populated to another row in the datagrid? (i.e. I have a drop down which I want to populate...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
1
by: teddarr | last post by:
I have a TList that returns several items in C#. I want to pull 3 entities from this tlist to assign to variables. 2 of the 3 will be displayed in a datagrid. How do I assign these values to the...
1
by: Tarik Monem | last post by:
Hi everyone and I hope that you can help. I am trying to send a value of a cell within a Datagrid to my php file which has a simple sql query: here's the php: <? $server = "localhost";
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.