Completed
Last Updated: 17 Nov 2015 16:27 by ADMIN
ADMIN
Stefan
Created on: 06 Mar 2013 08:12
Category: GridView
Type: Bug Report
2
FIX. RadGridView - wrong rows are selected in a sorted grid with rows added between BeginUpdate/EndUpdate calls
To reproduce:
- add a grid to the form and use the following code for its setup:
            radGridView2.Columns.Add("ID");
            radGridView2.Columns.Add("Title");
            radGridView2.MultiSelect = true;
            radGridView2.Columns[0].SortOrder = RadSortOrder.Ascending;
            radGridView2.ReadOnly = true;

            radGridView2.BeginUpdate();
            for (int i = 0; i < 5; i++)
            {
                GridViewDataRowInfo row = new GridViewDataRowInfo(radGridView2.MasterTemplate.MasterViewInfo);
                row.Cells["ID"].Value = i;
                row.Cells["Title"].Value = "Title " + i;
                radGridView2.Rows.Add(row);
            }
            radGridView2.EndUpdate(true);

            radGridView2.Rows[0].IsCurrent = true;
            radGridView2.Rows[0].IsSelected= true;

- Once the application is started, hold down the shift key and click the third row in the grid 

Expected result: the first three rows are selected
Actual result: the last three rows are selected

WORKAROUND:
Use the BeginUpdate and EndUpdate methods of the TableElement, not the control:
radGridView2.TableElement.BeginUpdate();
//add rows
radGridView2.TableElement.EndUpdate(true);
0 comments