javascript - Prevent Postback with custom jQuery confirm implementation on asp:LinkButton -


i have linkbutton executes on server , changes page. historically, i've had confirm message box executes onclientclick ensure user navigate away.

so far looks this:

asp.net:

<asp:linkbutton runat="server" id="changepage" text="change page"                 onclientclick="confirm('are sure want change page?');"                  onclick="navigate" >     change page </asp:linkbutton> 

html output:

<a id="maincontent_changepage"     onclick="confirm('are sure want change page?');"    href="javascript:__dopostback('ctl00$maincontent$changepage','')" >     change page </a> 

this works fine this. trouble i'm trying replace confirm boxes prettier jquery-ui implementation this:

window.confirm = function (message, obj) {     $('<div/>')     .attr({ title: 'webpage confirm'})     .html(message)     .dialog({         resizable: false,         modal: true,         width: 500,         buttons: {             "ok": function () {                 __dopostback(obj, '');                 $(this).dialog('close');                 return true;             },             "cancel": function () {                 $(this).dialog('close');                 return false;             }         }     }); }; 

i believe has fact confirm dialog operates synchronously, while jquery dialogs occur asynchronously. however, thought setting modal: true cause wait response.

how can override window.confirm consistent behavior?


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -