This is a migrated thread and some comments may be shown as answers.

Rows not de-selecting

1 Answer 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nordy
Top achievements
Rank 1
Nordy asked on 03 Mar 2008, 11:24 PM
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:

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.

1 Answer, 1 is accepted

Sort by
0
Nordy
Top achievements
Rank 1
answered on 03 Mar 2008, 11:33 PM
Scratch that.  Apparently, it was because the SelectionMode property was set to CellSelect.
Tags
GridView
Asked by
Nordy
Top achievements
Rank 1
Answers by
Nordy
Top achievements
Rank 1
Share this question
or