Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a gridview(GridView1) with some rows of data and Checkbox for each row.
I want to populate another gridview (GridView2) with Selected rows from GridView1
on Button_Click.
Can anyone help me on this?

Thanks,
Posted

1 solution

C#
protected void btnGo_Click(object sender, EventArgs e)
{
	DataTable dt = GridView1.DataSource;
	DataView dv = new DataView(dt, "TotalEmployees > 0", "Department", DataViewRowState.CurrentRows);
	GridView2.DataSource = dv;
	GridView2.DataBind();
}


Check this

I have updated it for proper understanding
 
Share this answer
 
v2
Comments
Donthi Thirupathi Reddy 20-Aug-11 5:34am    
Thanks for your reply
Its giving error at gvTest.DataSource.
gvTest means GridView1?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900