views:

31

answers:

2

hey Guys,

I wanted to know if there's a way I can bind an Asp.net Ajax event to two different JS functions ?

eg.

 var prm = Sys.WebForms.PageRequestManager.getInstance();
  if (!prm.get_isInAsyncPostBack())
  {
      prm.add_initializeRequest(InitializeRequest);
      prm.add_initializeRequest(InitializeRequest2);
  }

function InitalizeRequest() { ... }
function InitalizeRequest2() { ... }
+1  A: 

Exactly the way you just did it.

SLaks
+1  A: 

I guess not, you might use this :

var prm1 = Sys.WebForms.PageRequestManager.getInstance();
if (!prm1.get_isInAsyncPostBack())
{
    prm1.add_initializeRequest(InitializeRequest);
}

var prm2 = Sys.WebForms.PageRequestManager.getInstance();
if (!prm2.get_isInAsyncPostBack())
{
    prm2.add_initializeRequest(InitializeRequest);
}
function InitalizeRequest() { ... }
function InitalizeRequest2() { ... }
sza