Grid View for ASP.NET Web Forms - How to implement a delete confirmation dialog with a "don't ask me again" option
This example demonstrates how to implement a delete confirmation dialog with an option to prevent its display for subsequent grid row deletions.
The confirm dialog is based on the ASPxPopupControl. The popup contains the dialog content wrapped in a WebUserControl.
Note: In this example, the "Don't ask for confirmation" check box's value is stored in a client JavaScript variable (
dontAskConfirmation
). We recommend that in a real-life application, you save this value to a user-specific storage such as cookies or user profile settings.
The example application uses the following techniques:
-
The
ID
field value of the processed row is stored in the clientrowVisibleIndex
variable. -
The ASPxPopupControl is made transparent so that it displays its child ASPxRoundPanel as the dialog's immediate container.
-
The ASPxPopupControl is used in modal mode and configured to always be displayed at the Grid View's center.
-
The "Yes" button is the dialog's default button (its ID is assigned to the ASPxRoundPanel's DefaultButton property), so users can press
Enter
to submit the dialog. The "Yes" button programmatically receives the input focus after the dialog is shown.
- TestData.cs (VB: TestData.vb)
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
- WebUserControl.ascx (VB: WebUserControl.ascx)
- WebUserControl.ascx.cs (VB: WebUserControl.ascx.vb)
- How to include a deleted row KeyField value into the delete confirmation dialog
- How to insert (or update) ASPxTreeList's row by clicking on an external button and delete rows with custom confirmation popup window
- How to show a confirmation dialog using ASPxPopupControl
(you will be redirected to DevExpress.com to submit your response)