views:

16

answers:

2

Anyone got any ideas?

The above error occurs when the following code is run:

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

Within this block:

<script language="javascript" type="text/javascript">
    var postBackElement;

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RequestCompleted);
    Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequestHandler);

    function InitializeRequestHandler(sender, args) {
        //set the postBackElement
        postBackElement = args.get_postBackElement();
    }
+1  A: 

You need to handle the RequestCompleted event if you're going to use it:

function RequestCompleted(sender, args) {
   // Do what you need to do here
}

If you don't need to handle the event, just remove this line from your markup:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(RequestCompleted);
GenericTypeTea
Thanks - I was just coming back to say I'd worked it out - will put brain in gear before posting next time!
Jim
@Jim - No problem.
GenericTypeTea
Deleted mine, +1 to yours. No point having the same answer here twice :-)
Andy E
@Andy E - Thanks mate. I did notice you posted about 26 seconds before me though :P. Sorry!
GenericTypeTea
@Gen: no worries, it happens. Yours was slightly better anyway, I think :-)
Andy E
@Andy E - Slightly off topic, you on Twitter?
GenericTypeTea
@Gen: no :-) I avoid most forms of social networking - I even rarely use my Facebook. This is about as social as it gets for me online ;-)
Andy E
A: 

I think that all you need to do is emit a script block like this:

function RequestCompleted(sender, args) {
  alert("Finished AJAX");
}
Russ C
Giving the same answer 5 mins after two other identical answers is not usually the polite thing to do.
GenericTypeTea
Being rude isn't either.When I started writing my response I had left my comment and there were no other answers.
Russ C