Ajax Control Toolkit
ConfirmButton Demonstration
Click Me

ConfirmButton Description

ConfirmButton is a simple extender that catches clicks on a button (or any instance of a type derived from Button) and displays a message to the user. If the "OK" button is clicked, the button or link functions normally. If not, the click is trapped and the button will not perform its default submit behavior; optionally, a client script is executed if the OnClientCancel property is set. This is useful for delete links or anything else that requires confirmation from the user.

ConfirmButton Properties

The control above is initialized with this code. The italic properties are optional:

<ajaxToolkit:ConfirmButtonExtender ID="cbe" runat="server"
    ConfirmText="Are you sure you want to click this?"
    OnClientCancel="CancelClick" />
  • TargetControlID - The ID of the button or link for this extender to operate on.
  • ConfirmText - The text to show when you want to confirm the click. (Note: HTML entities can be used here (ex: "&#10;" for new-line))
  • OnClientCancel - The client-side script that executes when the cancel button is clicked in the confirm dialog.
  • ConfirmOnFormSubmit - True if the confirm dialog should wait until just before the form submits to display. This is useful when ASP.NET validators are in use and the confirm should be shown only after all validators pass.
  • DisplayModalPopupID - Optionally specifies the ID of a ModalPopup control to use for displaying the confirmation dialog (instead of window.confirm). When using DisplayModalPopupID, the following conditions must be met:
    • The ModalPopup must be configured to work against the same TargetControlID as the ConfirmButton (and should work properly if the ConfirmButton is disabled).
    • The ModalPopup must specify OkControlID and/or CancelControlID to identify the buttons corresponding to window.confirm's OK/Cancel buttons.
    • The ModalPopup must not specify OnOkScript or OnCancelScript.

Copyright © 2006-2009 Microsoft Corporation. All Rights Reserved.