I'm not sure what I'm doing wrong.
I am attempting to configure my object so that the object's method is called during the onbeforeunload event of the page.
I have it so that it calls the method during the begin request of an Ajax call to the server...I don't know why I can't get the onbeforeunload event to work
Here's what I have (I'm using the Ajax.NET library):
Thanks,
-Frinny
I am attempting to configure my object so that the object's method is called during the onbeforeunload event of the page.
I have it so that it calls the method during the begin request of an Ajax call to the server...I don't know why I can't get the onbeforeunload event to work
Here's what I have (I'm using the Ajax.NET library):
Code:
MyNamespace.MyClass = function(element) { MyNamespace.MyClass.initializeBase(this, [element]); this._onBeginRequestHandler = Function.createDelegate(this, this._onBeginRequest); this._onEndRequestHandler = Function.createDelegate(this, this._onEndRequest); var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_beginRequest(this._onBeginRequestHandler); prm.add_endRequest(this._onEndRequestHandler); // Here is what is not working window.onbeforeunload = this._myMethod; //I have also tried the following but it doesn't work either: // window.onbeforeunload = this._onBeginRequestHandler; //since the _onBeginRequestHandler method just calls _myMethod anyways. }
-Frinny
Comment