If you are binding the data from the table then you can just write it as :
Gridview2.DataSource = GridView1.DataSource;
or if you just going to add only selected Rows then :
Take a CheckBox inside the Gridview' ItemTemplate
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server"/>
</ItemTemplate>
Take a Button to pass data to next Page
<asp:Button ID="btnTransfer" runat="server" onclick="btnTransfer_Click"
Text="Send" />
Write this code in the Button click
DataTable dtPass = new DataTable();
protected void btnTransfer_Click(object sender, EventArgs e)
{
dtPass.Columns.Add("Name", typeof(string));
dtPass.Columns.Add("Gender", typeof(string));
foreach (GridViewRow row in GridView1.Rows)
{
if (((CheckBox)row.FindControl("checkBox1")).Checked == true)
{
//Get data of ItemTEmplate of table Fields
string lblname = ((Label)row.FindControl("lblName")).Text;
string lblgender = ((Label)row.FindControl("lblGender")).Text;
DataRow dtRow = dtPass.NewRow();
dtRow["Name"] = lblname;
dtRow["Gender"] = lblgender;
dtPass.Rows.Add(dtRow);
}
}
Now assing this dt :
GridView2.DataSource = dtPass;
GridView2.DataBind();