OK, here is my approach (it works, but it may not be the best solution):
$(document).ready(function () { $('#dialog-confirm-cancel').dialog({ autoOpen: false, modal: true, buttons: { "Delete all items": function () { // invoke the href (postback) of the linkbutton, // that triggered the confirm-dialog eval($(this).dialog('option', 'onOk')); $(this).dialog("close"); }, Cancel: function () { $(this).dialog("close"); } } }); $('.btnDelete').click(function () { $('#dialog-confirm-delete') // pass the value of the LinkButton href to the dialog .dialog('option', 'onOk', $(this).attr('href')) .dialog('open'); // prevent the default action, eg, following a link return false; }); });
source share