The ScriptManager and UpdatePanel usage of AJAX controls

Source: Internet
Author: User

The company project is used to UpdatePanel, completely unknown so.

Fortunately, the great God to my careful explanation, write a diary to commemorate.

Role: for page local refresh! Do not interfere with other control content!

1. First in the page declaration <asp:scriptmanager id= "ScriptManager1" runat= "Server" ></asp:ScriptManager>
Annotations:
1, ScriptManager (script controller) is the basis for the existence of ASP.
2, a page allows only one ScriptManager, and is placed in front of other Ajax controls.
3,scriptmanager runs the multi-script of the client Ajax page and registers the Ajax class library in the page to implement local updates to the page and calls to the Web service.

2. Add the following code to the Body Content section

<asp:updatepanel id= "Updatepanel_1" childrenastriggers= "false" updatemode= "Conditional" runat= "Server" >
<Triggers>
<asp:asyncpostbacktrigger controlid= "Btngetcode" eventname= "click"/>
</Triggers>
<ContentTemplate>
<asp:label id= "Lblresult" runat= "Server" text= "Label" ></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
Note: The control ID named: "Btngetcode" control, when it fires the Click event, asynchronously executes the control-bound click Function, the function executes the result, echoing back to the <contenttemplate></ Contenttemplate> within the control of two elements!

2. Backstage Btngetcode_click section Add the following code, only need to assign value to Lblresult on the line

The ScriptManager and UpdatePanel usage of AJAX controls

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.