I have a button with Yes options or not when I want to delete a record. When I give him if he should make the submit of the page and he does not do it. The button is a gridview in webforms:
<asp:TemplateField HeaderText="Eliminar">
<ItemTemplate>
<asp:ImageButton ID="btnEliminar" runat="server" ImageUrl="~/Content/Images/document_delete.png" Height="22px" Width="22px" CommandName="Eliminar" AlternateText="Eliminar" />
</ItemTemplate>
</asp:TemplateField>
Uncaught ReferenceError: __doPostBack is not defined at HTMLInputElement. ( link ) at HTMLInputElement.dispatch ( link ) at HTMLInputElement.r.handle ( link ) at Object.trigger ( link ) at HTMLInputElement. ( link ) at Function.each ( link ) at n.fn.init.each ( link ) at n.fn.init.trigger at n.fn.init.n.fn. (anonymous function) [as click] at HTMLDivElement.click
Here is the code:
< script type = "text/javascript" >
$(function() {
$("[id*=btnEliminar]").removeAttr("onclick");
$("#dialog").dialog({
modal: true,
autoOpen: false,
title: "Export Access",
width: 350,
height: 160,
buttons: [{
id: "Yes",
text: "OK",
click: function() {
$("[id*=btnEliminar]").attr("rel", "delete");
$("[id*=btnEliminar]").click();
}
},
{
id: "No",
text: "NO",
click: function() {
$(this).dialog('close');
}
}
]
});
$("[id*=btnEliminar]").click(function() {
if ($(this).attr("rel") != "delete") {
$('#dialog').dialog('open');
return false;
} else {
__doPostBack(this.name, '');
}
});
}); </script>