Passing the selected gridview row to a new page for edit
Hi , I am a newbee. Please help
I have a gridview displayed in page1
and when a row is selected data on the row should be displayed in page2.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Aug 6, 2009, 1:45 PM
CheckBox1.Text = Session["Discontinued"].ToString();
// if want to Check the Check Box
CheckBox1.Checked = Convert.ToBoolean(Session["Discontinued"]);
ck bluesPosted Aug 6, 2009, 11:12 PM
ck bluesPosted Aug 6, 2009, 11:07 PM
ck bluesPosted Aug 6, 2009, 11:05 PM
Kirtan PatelPosted Aug 6, 2009, 9:31 PM
Post your Code of Page 1
and What you have Coded in Page 2 Here
I m not getting you Explain a lil bit what you want to achieve as Final Result .
Happy Coding :)
ck bluesPosted Aug 6, 2009, 5:28 PM
Kirtan PatelPosted Aug 6, 2009, 3:22 PM
Session["Discontinued"] = checkBox1.Checked ;then you can Check it at receiving time in page 2
like below
ck bluesPosted Aug 6, 2009, 3:07 PM
ck bluesPosted Aug 6, 2009, 12:29 PM
Kirtan PatelPosted Aug 6, 2009, 11:32 AM
Happy Coding :)
ck bluesPosted Aug 6, 2009, 11:11 AM
Kirtan PatelPosted Aug 6, 2009, 10:15 AM
Make Sure You have Selected the Row First Then Press Edit and Grid Must Have Some Data like Below Image
Error Says that GridView's Cell[0] contain Null Data ( having No string Value )
You can Check the Grid's Content before Sending it to Session
if your Cell[0] is template field Then let me know other Wise Code is Correct
Happy Coding :)
ck bluesPosted Aug 6, 2009, 9:56 AM
Kirtan PatelPosted Aug 6, 2009, 1:58 AM
you can do this By Session use Following Code
In Page 1 Write Code as below for example if We are passing two columned Row(Username ,Password)
In Page 2 Write Code Below to Retrieve Data From Session that We have Stored in Session
if you liked my Answer Don't Forget to mark it as Answer :)
Happy Coding :)
ck bluesPosted Aug 6, 2009, 1:36 AM
Deependra KhangarotPosted Aug 6, 2009, 1:17 AM
Kirtan PatelPosted Aug 6, 2009, 12:41 AM
Now in Page 1 Write Code In Button1 to pass the Data to that class and We can retrieve content passed to class from page 2
Page 1 Code is Below
You can also Do this Task Without Creating Class File With Session But If you Create Class you can Manage the Code Efficiently.