Description:
Confirm row deletion when using an embedded navigator
Answer:
You should use the ButtonClick event of the grid's Navigator. Here is some sample code:
C#using DevExpress.XtraEditors;
private void gridControl1_EmbeddedNavigator_ButtonClick(object sender, NavigatorButtonClickEventArgs e) {
if(e.Button.ButtonType == NavigatorButtonType.Remove) {
if(MessageBox.Show("Do you want to delete the current row?", "Confirm deletion",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) != DialogResult.Yes)
e.Handled = true;
}
}
Visual BasicAddHandler GridControl1.EmbeddedNavigator.ButtonClick, AddressOf Grid_DataNavigator1_ButtonClick
...
Private Sub Grid_DataNavigator1_ButtonClick(ByVal sender As Object, ByVal e
As DevExpress.XtraEditors.NavigatorButtonClickEventArgs)
If e.Button.ButtonType = DevExpress.XtraEditors.NavigatorButtonType.Remove Then
If MessageBox.Show("Do you want to delete the current row?", "Confirm deletion", _
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) <> DialogResult.Yes Then
e.Handled = True
End If
End If
End Sub
See Also:
A147
I tried your sample and its working but the row its deleted even when i press No
Hello,
I created a separate ticket on your behalf for this question: The code snippet from the 'Confirm row deletion when using an embedded navigator' KB article works incorrectly. I will update it as soon as possible.