Some problems may occur when updatepanel and jquery are used together.
Problem reproduction:
1. Create a separate page.
2. Add updatepanel1 to updatepanel1 and add labela to updatepanel1.
3. Add button1 as autopostback.
4. Write the jquery statement to update the labela content, and add "1" to the interface each time it is updated ".
5. Add scriptmanager.
5. Open this page and you can see that labela has been updated. Then click button1. labela will not respond.
Problem Analysis:
Updatepanel is only used for partial update. The core of updatepanel to implement partial refresh is the microsoftajaxwebform. js file. Its partial refresh process is to submit the page to the server (including viewstate) and execute the serverCodeThen, the HTML in updatepanel is re-rendered asynchronously. In this process, the status of other parts of the page does not change. The partial update of updatepanel does not prompt the whole Dom to be reloaded, while the jquery function () entry is executed only after the whole Dom is updated once.
Correction Method:
Add SYS. webforms. pagerequestmanager. getinstance (). add_endrequest (endrequesthandler) to the function () method of jquery );
It is used to capture the endrequest event of scriptmanager and put the method to be executed after PostBack in the endrequesthandler method. This part of jquery statements will be executed after each PostBack operation.
Experience:
When using updatepanel and jquery, pay attention to the conflict between the two. Use the server to refresh the interface and try to avoid refreshing with the client at the same time.