asp.net ajax and asp.net are perfectly combined, and it's hard to think of jquery when you find it's not enough. Common jquery and ASP.net ajax are commonly used in conjunction with two things, and if handled well, they don't conflict. But the recent discovery of JQuery's Ready () function in the postback back, ready execution of the action is ineffective, first impression: Will not asp.net Ajax and jqueryd ready conflict, and then remove asp.net ajax script references , and sure enough, everything is fine. After thinking, finally to ASP.net Ajax ScriptManager add a add_endrequest (), jquery ready finally back to normal.
| code is as follows |
&nbs P; |
| <script type= "Text/javascript" SYS.W EbForms.PageRequestManager.getInstance () add_endrequest (endrequesthandler); &NBSP;&NBSP;&NBSP function Endrequesthandler (sender, args) { if (Args.get_error () == undefined) { Pageinit (); } } function Pageinit () { $ (document). Ready ( function () { //todo }); } &NBSP;&NBSP; pageinit (); </script> |
Where, add this code, there are some things to note that if this script is placed in the head, an error occurs, prompting the Sys object undefined, because the asp.net Ajax ScriptManager, is not finished, the Sys object must not be found, At this point the script is placed at the end of the body, everything is normal.