Search code examples
devexpress-windows-ui

DevExpress set focus to specific row of VerticalGrid


My code to set the focus to a specific row of the VerticalGrid is not working.

this.ActiveControl = vGridControl1;
vGridControl1.Focus();    
vGridControl1.FocusedRow = vGridControl1.GetRowByFieldName("addr1");

I have confirmed that vGridControl1.GetRowByFieldName("addr1") returns the correct row.

The first row contains a ButtonEdit, and that is where focus always goes.

The grid is in MultiRecordView but at this point contains only one (new) blank record. Adding

vGridControl1.FocusedRecord = 0;

before setting the FocusedRow doesn't make a difference.

What step am I overlooking?


Solution

  • Try using this which worked for me...

        vGrdSummary.Focus()
        vGrdSummary.FocusedRow = vGrdSummary.Rows("rowNatureOfLoss")