AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
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 asp.net 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);
ds.Tables[0].Rows.Add(r1);
}


}


}

Session["temp"] = ds;



Response.Redirect("getcategories.aspx");






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



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

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
When Good HTML Goes Bad: How You Can Protect Your Web Applications
Introduction to Software Development
Programmers Heaven C# School Book - Free 338 Page eBook