just you target on grid cell which one contain primary field data
and set those value on any control on the time of editing
like i have a primary field those name is "className" and it's possition on grid is cell[2] for each row and when i click on edit button this primary field value set on txtclassname text control.
This code is used to select updated Row
foreach (DataGridViewRow row in dgvClassData.Rows)
{
if (row.Cells[2].Value.ToString().Equals(txtClassName.Text))
{
dgvClassData.Rows[row.Index].Selected = true;
}
}
Thanks & Regard
Sham :)