title: Select a row in a DataGridView, from the index of the DataSource
body: <p>I have a <code>DataGridView</code> that I populate from a view in PostgreSQL:</p>
  
  <pre><code>dataSource = new BindingSource();
  dgData.DataSource = dataSource;
  dataSource.DataSource = Program.DB.GetView(dbView, filter);
  </code></pre>
  
  <p>(<code>Program.DB.GetView</code> returns a <code>DataTable</code>)</p>
  
  <p>when I have a row selected and I sort the <code>DataGridView</code>, my selection is stuck at the same index. I want the selection to stay at the selected record.</p>
  
  <p>I have tried to get the first column (which is the database's primary key) and use that to refer a row in the view, but I don't know how to do it properly.</p>
  
  <pre><code>if (dgData.SelectedRows.Count == 1) {
       rowIdx = (int)dgData.SelectedRows[0].Cells[0].Value;
       colName = dgData.Columns[0].Name;
  }
  </code></pre>
  
  <p>Now, how to use the <code>rowIdx</code> to set a row's <code>Selected</code> property in the <code>DataGridView</code> to <code>true</code> ?</p>