Tim
Tim

Reputation: 8921

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?

Upvotes: 0

Views: 880

Answers (1)

ChrisGrahamUK
ChrisGrahamUK

Reputation: 51

Try using this which worked for me...

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

Upvotes: 1

Related Questions