call asp.net method from jquery dialog button -
i tying create delete confirmation dialog. here's jquery dialog
$(function () { $("#del-dialog").dialog({ autoopen: false, width: 300, height: 100, modal: true, close: function (event, ui) { location.reload(false); }, buttons: { 'delete': function () { $(this).dialog('close'); // delete function goes here }, 'cancel': function () { $(this).dialog('close'); } }, }); $(".icon-del").click(function (event) { event.preventdefault(); $("#del-dialog").dialog("open"); }); });
and asp code:
l += "<a onclick='hello("; l += dr["cid"].tostring(); l += ");'>"; l += "</a>";
how handle delete function dialog button?
$(function () { $("#del-dialog").dialog({ autoopen: false, width: 300, height: 100, modal: true, close: function (event, ui) { location.reload(false); }, buttons: { 'delete': function () { $(this).dialog('close'); var target=$("#del-dialog").data("event").currenttarget $(target).data('isconfirming', true); target.click(); $(target).data('isconfirming', null); }, 'cancel': function () { $(this).dialog('close'); } }, }); $(".icon-del").click(function (event) { if($(event.currenttarget).data('isconfirming')) return; event.preventdefault(); $("#del-dialog").data("event",event); $("#del-dialog").dialog("open"); }); });
Comments
Post a Comment