How To Wait On The __dopostback Method To Complete In Javascript?
I am using the __doPostBack method to refresh the UpdatePanel in javascript. I just want to wait for the update panel to get updated and then execute the subsequent javascript code
Solution 1:
Use the Sys.WebForms.PageRequestManager endRequest event:
<script type="text/javascript" language="javascript">
function clearPostBack() {
$get('__EVENTTARGET').value = $get('__EVENTARGUMENT').value = '';
Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(clearPostBack);
// TODO: anything you want after __doPostBack
}
function myPostBack(eventTargetUniqueId, eventArgument) {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(clearPostBack);
__doPostBack(eventTargetUniqueId, eventArgument);
}
</script>
Post a Comment for "How To Wait On The __dopostback Method To Complete In Javascript?"