[Experience sharing] Ajax Control ToolKit Practice 3: confirm the application of the prompt box (ConfirmButtonExtender)

Source: Internet
Author: User

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.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.