This document describes how to use the ConfirmButtonExtender Control in Ajax Control ToolKit.
Main function: Add a prompt box for the button. This function can also be implemented using javascript, but it is more convenient to use directly.
Start to use:
1. Add the ScriptManager control on the page.
2. Add UpdatePanel to the page. This is to define the brushless area. Put the required content here.
3. In UpdatePanel, add a Button control. id = Button1
4. In UpdatePanel, add a ConfirmButtonExtender control. Set TargetControlID = "Button1", ConfirmText = "are you sure you want to submit? "
5. Add a Button1_Click event to the button control. Write the event as follows:
ScriptManager. RegisterClientScriptBlock (this. Page, typeof (DemoTestPage), "commit", "alert ('your submission has been successful. Thank you ');", true );
Display Effect:
1. Click the button1 button. Are you sure you want to submit it? .
2. Click OK. The prompt box Indicating that your submission is successful is displayed. Thank you.
3. If you click the cancel button, no operation is performed.
Note:
1. Set up the ajax Environment
2. The ScriptManager control is indispensable.
3. The button and ConfirmButtonExtender controls must be placed in UpdatePanel. Alternatively, the button and ConfirmButtonExtender must be placed out of UpdatePanel. Then, the AsyncPostBackTrigger of UpdatePanel Triggers sets the ControlID as the Button
4. Do not use the response. write () method in the button event, which will cause an error.