lunes, 16 de noviembre de 2009

Capture ASP.NET Update Panel Begin Request and End Request

This time I explain the possibility to call some javascript code when update panel execute a request. This code get the begin request and end request events.

Instance of scriptmanager in asp.net

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>

Put this code in javascript file or page with script tag's.

Script tag:

<script language="javascript"> //Code Here </script>




Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandle);

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandle);


function beginRequestHandle(sender, Args){
//some code here
alert('Begin Request');

}





function endRequestHandle(sender, Args){

//  some code here
alert('End Request');
}

other events:
  • initializeRequest: This event is before begin postback.
  • pageloading: Execute after the last postback has been received but before the page is updated.
  • pageLoaded: Execute after the regions of the page have been updated after the last postback
any suggestion leaves a comment.
good luck.

1 comentario: