Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends,

How to pass Gridview column value to another page.

I have 2 pages

In first page I have gridview
In 2nd page i have textbox.

I can pass complete row to 2nd page using Query String. But I need to display selected Gridview column value in 2nd page textbox.

Please help.
ThanQ
Posted
Comments
Krunal Rohit 13-Nov-15 9:43am    
Use Session.

-KR

I have solve this problem.i took 2 web pages,and at the first page i have a gridview with AutoGenerateSelectButton True and on the second Page i took a textbox and write the following code...

C#
protected void Page_Load(object sender, EventArgs e)
      {
          GridView gvEmployee = (GridView)PreviousPage.FindControl("gvEmployee");
          int index = gvEmployee.SelectedRow.RowIndex;
          txtEmpName.Text = gvEmployee.Rows[index].Cells[2].Text;
      }



Using the above code you can get the selected row column on the other page.

thanks....
 
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