Click here to Skip to main content
15,911,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to Transfer selected data to one form to an other form, and displayed to gridview.
i have one form that will display information about product like (ProductID, ProductName and UnitPrice) in gridview
also there is one button.

now i want to redirect my first page to second page when i click on that button shown in gridview of first page.
and on the second page there is also one grid that will show the product information transferred from first page button click event.

my Problem is...
1. I have no knowledge about gridviews item events
2. and also i dont know how to transfer data to an other form

only one row at a time will be transfer to an other form..

pleas help me
Posted
Updated 26-Sep-11 21:17pm
v3
Comments
Tejas Vaishnav 27-Sep-11 3:17am    
Type your question properly so other can understand it.

* Create an event for "CellMouseClick" on datagridview1

C#
private void datagridview1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
          if (e.Button == MouseButtons.Left)
           {
/// checks the column by it's name                   
if (e.ColumnIndex == datagridview1.Columns["colSelect"].Index)
                   {
                   DataGridViewRow currentRow = dataGridView1.Rows[e.RowIndex];
                dataGridView2.Rows.Add(currentRow.Cells["ProductID"].Value, currentRow.Cells["ProductName"].Value, currentRow.Cells["UnitPrice"].Value);
                   }

                }
            }
 
Share this answer
 
v2
hi,

For your first problem,I suggest to read following links

and one more thing is every control has event like button click events or changed events.there is no such difficult in data controls .

http://www.deeptraining.com/litwin/Litwin_ASP_DataControlsTips.pdf


data controls has some events link itemcommand,editcommand,delete command..

Here itemcommand means it'll raise when u click on any button inside data control

And comming to your second problem

we don't pass entire data from one page to another page.we just pass productid of that product which you selected in first page.

In the second page we retrieve full information based on that productid from database and show in data control.


All the Best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900