Hi Sagar55,
DataTable dtOutput=new DataTable(); // Assign in Global
In your DataGridView1 CellBeginEdit Event write the following code
void dataGridView1_CellBeginEdit(object sender,DataGridViewCellCancelEventArgs e)
{
DataTable dtGrid1=(DataTable)DataGridView1.DataSource;
string sId=DataGridView1.Rows[e.RowIndex].Cells["Id"].Value.ToString();
DataRow[] drFilter=dtGrid1.Select("Id="'+sId+'"");
DataTable dtData=new DataTable();
dtData=dtGrid1.Clone();
foreach(DataRow dr in drFilter)
{
dtData.ImportRow(dr);
}
if(dtOutput.Columns.Count==0)
{
dtOutput=dtGrid1.Clone();
}
dtOutput.Merge(dtData);
DataGridView2.DataSource=dtOutput.Copy();
}
I hope this code useful to you.
Cheers :)