I'm using the following code to select rows in a control that I've derived from the RadGridView control that has already been populated with data:
_KeyMappings is a Dictionary<int, int> that maps primary key values to row indecies, and _KeyMember defines what the primary key is. This works great, until the user tries to click on a row. I'd LIKE the selected rows to clear out (since the user just picked a new one), as the code above is simply for setting the start up state of the control from data, but they don't. When the user clicks a new row, any previously selected rows should become unselected.
public void SelectRows(DataTable tbl) |
{ |
foreach (DataRow row in tbl.Rows) |
this.Rows[_KeyMappings[Convert.ToInt32(row[_KeyMember])]].IsSelected = true; |
if (tbl.Rows.Count > 0) |
this.CurrentRow = this.SelectedRows[0]; |
this.Update(); |
} |
_KeyMappings is a Dictionary<int, int> that maps primary key values to row indecies, and _KeyMember defines what the primary key is. This works great, until the user tries to click on a row. I'd LIKE the selected rows to clear out (since the user just picked a new one), as the code above is simply for setting the start up state of the control from data, but they don't. When the user clicks a new row, any previously selected rows should become unselected.