hi guys  transferring  selected rows of gridview to another gridview with button click. and vice versa by selecting checkbox  No data is present in second gridview. . but i am getting above error:here is my code:
protected void cmdRight_Click(object sender, EventArgs e) { DataTable dtLeft = (DataTable)ViewState["dtLeft"]; DataTable dtRight = (DataTable)ViewState["dtRight"]; int tmp = 0; foreach (GridViewRow oItemLeft in GridView1.Rows) { if (((CheckBox)oItemLeft.FindControl("chk")).Checked) { dtRight.Rows.Add(GridView1.DataKeys[oItemLeft.DataItemIndex].Value, oItemLeft.Cells[1].Text, oItemLeft.Cells[2].Text); dtLeft.Rows.RemoveAt(oItemLeft.DataItemIndex - tmp); tmp++; } } GridView2.DataSource = dtRight; GridView2.DataBind(); ...

Go to the complete details ...