Hi!!!,
how to select multiple rows in a gridview using checkbox and pass those selected values to another gridview which is in another page???
thank u!!
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 21, 2013, 3:02 AM EDT
http://www.aspsnippets.com/Articles/Transfer-Selected-Rows-from-one-GridView-to-Another-in-Asp.net.aspx
http://www.devasp.net/net/articles/display/1368.html
Arul Manivannan48 reputationPosted Mar 21, 2013, 1:44 AM EDT
This code may look oldie but work like a charm.
Put a button called Transfer.
On the Transfer Button click event
protected void Button1_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
for (int j = 0; j < GridView1.Rows.Count; j++)
{
DataRow dr;
GridViewRow row = GridView1.Rows[j];
dr = dt.NewRow();
for (int i = 0; i < row.Cells.Count; i++)
{
dr[i] = row.Cells[i].Text;
}
dt.Rows.Add(dr);
}
In the first page
In the next page
GridViewNextpage.DataSource = dtnewpage;
GridViewNextpage.DataBind();
I dint try this code personally and if error occurs, go with the logic
loop through gridview
check for the checkbox values (checked or uncheked)
insert it into datatable when the row is checked.
u will get a datatable
pass the datatable into viewstate
get the viewstate to datatable in the next page
assign this datatable as datasource to the newgrid.
Cheers..
Arul Manivannnan
AbhiPriya M V63 reputationPosted Mar 22, 2013, 8:28 PM EDT