Cancel Multiple Postback Requests

Listing 2. Cancel successive asynchronous postback requests by handling the PageRequestManager's initializeRequest event.

function InitRequest(sender,args)
{
    if (prm.get_isInAsyncPostBack() && 
      args.get_postBackElement().id == 'btnRefresh') {
       args.set_cancel(true);
       if ($get("divChill").style.visibility != "visible")
       {
          $get("divChill").style.visibility = "visible";
          setTimeout("ClearDiv()", 2000);
       }
    }
}

function ClearDiv()
{
    $get("divChill").style.visibility = "hidden";
}