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.
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.
Satyapriya NayakPosted Mar 21, 2013, 7:02 AM
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
AbhiPriya M VPosted Mar 23, 2013, 12:28 AM
Arul ManivannanPosted Mar 21, 2013, 5:44 AM
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