Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Perform Custom Actions when End-Users Click Navigator Buttons

The following sample code handles the NavigatorBase.ButtonClick event to confirm with the user before deleting a record. A warning message box is shown each time a user presses the Remove button. The user can then click the Yes button to remove the current record or alternatively the No button to cancel deletion of the record.

using DevExpress.XtraEditors;

private void dataNavigator1_ButtonClick(object sender, NavigatorButtonClickEventArgs e) {
    if (e.Button.ButtonType == NavigatorButtonType.Remove)
        if (MessageBox.Show("Do you really want to delete the record?", "Warning", 
          MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
            e.Handled = true;
}