Tuesday, 3 January 2012

To Handle asynchronous clicks in Update Panels

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
var postBackElement;
function InitializeRequest(sender, args)
{
  if (prm.get_isInAsyncPostBack())
  args.set_cancel(true);
  postBackElement = args.get_postBackElement();
if(document.getElementById('ctl00_ContentPlaceHolder1_UpdateProgress1')!=null)
  document.getElementById('ctl00_ContentPlaceHolder1_UpdateProgress1').style.display = 'block';
 

}
function EndRequest(sender, args)
{
if(document.getElementById('ctl00_ContentPlaceHolder1_UpdateProgress1')!=null)
 document.getElementById('ctl00_ContentPlaceHolder1_UpdateProgress1').style.display = 'none';
}

No comments:

Post a Comment