Display Selected Row from DataGrid to TextBoxes

Display selected row from DataGrid to TextBoxes. drag and down a DataGrid view and double click on DataGrid view.

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)

{
    SqlConnection con = new SqlConnection("server = MUNESH\\SQL2008R2;Database=data;UID=sa;Password=123;");

    DataGridViewCell cell = null;

    foreach (DataGridViewCell selectedCell in dataGridView1.SelectedCells)

    {

        cell = selectedCell;

        break;

    }

    if (cell != null)

    {

        DataGridViewRow row = cell.OwningRow;

        textBox1.Text = row.Cells["Name"].Value.ToString();

        id_txt.Text = row.Cells["ID"].Value.ToString();

        textBox3.Text = row.Cells["Age"].Value.ToString();

    }

}