LandonC
LandonC

Reputation: 899

ASP.NET postback causes AJAX exception

I have a basic asp.net webform that handles events via standard postback. On this page, I also have an AJAX call to a WCF service that is managed by the JavaScript proxy generated by a ScriptManager control. The problem I'm having is this: sometimes a user fires the AJAX request then fires a postback immediately afterward, which is causing the AJAX call to throw an exception. It appears to be a timing issue: if you wait until the AJAX request is complete, then postback, all is well. I thought I was doing an asynchronous request, so I'm not sure why I'm getting the error. Any thoughts would be much appreciated.

Upvotes: 0

Views: 214

Answers (1)

Joe
Joe

Reputation: 1669

check if async postback is in progress using isInAsyncPostBack property of PageRequestManager and postback is generated by this Button then cancel this request

http://www.atulverma.com/2010/06/how-to-disable-subsequent-submit-button.html

Upvotes: 0

Related Questions