How to get selected row index in devexpress gridcontrol?

godot picture godot · Apr 17, 2018 · Viewed 11.9k times · Source

I have devexpress gridcontrol which looks like that: enter image description here

I have click event on this red X button:

private void delete_button_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{

}

How can get there row index where this button is ?

Answer

Dmitrii Babich picture Dmitrii Babich · Apr 17, 2018

You can use the GridView.FocusedRowHandle property:

 view.DeleteRow(view.FocusedRowHandle);