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

Row 0 is always selected

1 Answer 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 30 Jul 2012, 07:24 PM

DISREGUARD:  I found the error and it was in another method that for some reason was coded to alwyas select the last row.


When ever my form is loaded with a radgirdview control on it the row 0 is always selected.  The grid is a multiselect and It is set so the user can select multiple rows and then click a button and all rows that are selected will be updated.

On the form load I have this code
POSSGridView.ClearSelection();
POSSGridView.CurrentRow = null;

and I loop through the rows as follows
foreach (GridViewRowInfo rowInfo in POSSGridView.Rows)
           {
               if (rowInfo.IsSelected)

The issue is when the form loads if I hit the button the .SelectedRows has row 0 in it.  If I select it and then select another row and hit the button not eh .SelectedRows has both rows as being selected even though on the screen the 0 row is not selected.  I am unalbe to find anyway to not have the 0 row selected.

1 Answer, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 07 Nov 2012, 12:49 PM
Hello Eric,

Also, there is a property on the MasterTemplate if i'm not mistaken to SelectLastAddedRow, or something very similar.

Best Regards,
Emanuel Varga
Winforms MVP
Tags
GridView
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Share this question
or