Prevent ASP.net __doPostback() from jQuery submit() within UpdatePanel

Posted by Ed Woodcock on Stack Overflow See other posts from Stack Overflow or by Ed Woodcock
Published on 2010-03-11T10:59:07Z Indexed on 2010/03/11 20:34 UTC
Read the original article Hit count: 1639

Filed under:
|
|
|

I'm trying to stop postback on form submit if my custom jQuery validation returns false.

Is there any way to prevent the __doPostback() function finishing from within the submit() function?

I'd assumed:

$('#aspnetForm').submit(function () { return false; });

would do the trick, but apparently that's not the case: does anyone have a suggestion?

The submit() function does block the postback (it won't postback if you pause at a breakpoint in firebug), but I can't seem to stop the event happening after the submit() function is complete!

Cheers, Ed

EDIT

OK, I had a quick mess about and discovered that the fact that the button I'm using to cause the postback is tied to an updatepanel as an asyncpostbacktrigger seems to be the problem: If I remove it as a trigger (i.e. cause it to product a full postback), the is no problem preventing the postback with return false;

Any ideas why the async postback would not be stoppable using return false?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery