Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 how to take data from gridview control from one page and take it to anotherpage
Posted by charan on  4/1/2010 3:58:46 PM Category: Asp.Net 2.0
Add to my favorites
Email to friend
hi iam using with c#

in my gridview control 1st column is checkbox,2nd column is product name, 3rd column is price, 4th column is quantity

5th column is total, when user selects any no of checkbox that selected row data i have to take it to another page in which

there is also an another gridview i have show the data from previous page

can you provide me a suitable example which helps me

Post Your Reply Post New Question

 Viewer's Reply
how to take data from gridview control from one page and take it to anotherpage
Answered By sharmeek on 4/2/2010 8:58:13 AM
Take all rows in session.
tranfering data from one gidview to another still not getting
Answered By charan on 4/3/2010 5:09:56 AM
foreach (GridViewRow r in GridView1.Rows)

for (int i = 0; i < GridView1.Rows.Count; i++)

if (((CheckBox)r.Cells[0].FindControl("chk")).Checked)

string CategoryNameE = r.Cells[1].Text;
DataRow r1 = ds.Tables[0].NewRow();
r1["CategoryNameE"] = CategoryNameE;

string ItemKey = r.Cells[2].Text;
//DataRow r1 = ds.Tables[0].NewRow();
r1["ItemKey"] = ItemKey;

string ItemKeyNameE = r.Cells[3].Text;
//DataRow r1 = ds.Tables[0].NewRow();
r1["ItemKeyNameE"] = ItemKeyNameE;

r1["CurrentQTY"] = Convert.ToInt32(r.Cells[4].Text);
r1["SalesPrice"] = Convert.ToDouble(r.Cells[5].Text);



Session["temp"] = ds;


if (Session["temp"]!= null)
// DataSet m1 =
//m1 = (DataSet)
GridView1.DataSource = (DataSet)Session["temp"];

still data is not displaying in the next page.
GridView Row Navigation
Answered By Moderator1 on 4/4/2010 9:56:38 AM

Remove the loop I mentioned below, it is no need.
for (int i = 0; i < GridView1.Rows.Count; i++)

Then try you code again..
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Introduction to Web Applications Development
Backup and Recovery Best Practices for Microsoft SQL Server 2005
The Art & Science of JavaScript - Free 100 Page Preview!