Completed
Last Updated: 15 Aug 2017 10:28 by ADMIN
ADMIN
Dimitar
Created on: 20 Mar 2017 13:11
Category: GridView
Type: Bug Report
0
FIX. RadGridView - the row position is reset when the IsSelected property of the row is set.
To reproduce:
private void RadGridView1_KeyPress(object sender, KeyPressEventArgs e)
{
    int startIndex = radGridView1.CurrentRow.Index +1;

    for (int i = startIndex; i < radGridView1.Rows.Count; i++)
    {
        var value = radGridView1.Rows[i].Cells["Name"].Value.ToString().ToLower();
        if (value.StartsWith(e.KeyChar.ToString()))
        {
            radGridView1.TableElement.ScrollToRow(radGridView1.Rows[i]);
            radGridView1.ClearSelection();
            radGridView1.Rows[i].IsSelected = true;
            radGridView1.Rows[i].IsCurrent = true;
            radGridView1.Columns[1].IsCurrent = true;
            break;
        }
    }
}

- Press some key so the grid is scrolled down, then press the down key.
- The first row is selected instead of the next one. 

Workaround:
remove this line:
radGridView1.Rows[i].IsSelected = true;
0 comments