Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to implement a delete confirm dialog with a "don't ask me again" option

$
0
0

This example demonstrates how you can implement a round-cornered delete confirm dialog providing end-users with an option to prevent subsequent dialog displaying.

The confirm dialog is implemented using the ASPxPopupControl. It contains a WebUserControl representing the dialog content. The content's top control is the ASPxRoundPanel, which provides the round corner appearance of the dialog. Within its children, the ASPxRoundPanel contains an ASPxLabel control showing the ID value of the row to be deleted, two command ASPxButtons ("Yes", "No") and an ASPxCheckBox that, if checked, enables further delete operations to be performed without confirmation.

Pay your attention that in this example the "Don't ask confirmation" check box' value is stored within a client-side script variable ("dontAskConfirmation"). In a real-life application, it's recommended to preserve this value within a user-specific store such as user profile settings or cookies, for instance (you can take a look at the following blog to learn more: http://mattberseth.com/blog/2007/11/dont_ask_me_again_delete_confi.html).

Note that in this sample the following features and tricks are realized to make it work as expected:
- The ID value of the processed row is stored within a client script variable ("rowVisibleIndex");
- The ASPxPopupControl is made transparent to display its child ASPxRoundPanel as the dialog's immediate container;
- The ASPxPopupControl is used in modal mode and customized, so that it is always displayed centered within the ASPxGridView control (try to resize grid columns and invoke the dialog);
- The "Yes" button is made the dialog's default button (using the ASPxRoundPanel's DefaultButton property) to allow dialog submitting by pressing the Enter key. The "Yes" button programmatically receives input focus after the dialog is shown.

In this demo, the grid's data source is implemented within the TestData.cs file and a collection of data rows is stored within session. To reset the demo to its initial state, click the "Reload demo" button.

See Also:
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


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>