0

I am trying to open other page and pass data for selected row in gridview to be displayed in that page when user click the select button. i want to display the data in text box. so that, user can make editing from that page. i dont know how to pass the data for that selected row to be displayed in other page. Can someone help me??

3
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by rohand
0

>i dont know how to pass the data for that selected row to be displayed in other page. Can someone help me??

Use Session state.

Click handler of button of page1.aspx

Session["firstname"]=textbox1.Text;
Session["lastname"]=textbox2.Text;

Page_load handler of page2.aspx

if(!IsPostBack){
   if(Session["firstname"]!=null) 
          TextBox1.Text=Session["firstname"].ToString();

   if(Session["lastname"]!=null) 
          TextBox1.Text=Session["lastname"].ToString();

  }
0

do one thing, before binding gridview with datatable or dataset, store whole datatable or dataset in Session.

Now I assume you have select button for each row in gridview. So you can pass the ID of particular row in query string of the page you want to open.

Now in page2, just cast session into datatable or dataset whatever you are using. Also store fetch ID from query string and pass it in tables Select() method. The Select() method of DataTable return array of DataRow.

So once you have data in datarow array, you can assign value from it to your textbox on page.

hope this will help you..


I am trying to open other page and pass data for selected row in gridview to be displayed in that page when user click the select button. i want to display the data in text box. so that, user can make editing from that page. i dont know how to pass the data for that selected row to be displayed in other page. Can someone help me??

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.