jQuery Delete dialog does not work

31 views Asked by At

I have a page with a GridView that has Deletebutton for each row. When clicking the button, I display jQuerydialog withConfirmandCancel` option.

This is the ItemTeplate for Delete button:

<ItemTemplate>
      <asp:Button ID="delete" runat="server" CommandName="delete" Text"Delete" CssClass="ui-button ui-widget ui-state-default ui-corner-all ui-butt-text-only" OnClientClick="return ShowDeleteConf('Are you sure you want to delete?');" />
</ItemTemplate>

This is the function:

function ShowDeleteConf(message) {

    $(function () {
        $('#deleteConf').html(message);
        $('#deleteConf').dialog({
           title: "Delete Confirmation",
           buttons: {
              Cancel: function () {
                  $(this).dialog('close');
              },
              Confirm: function () {
                  return true;
              }
           }
      });
   });
}

When I click Delete button, the dialog is displayed for 1 second and is closed by itself, so I cannot event press any button.

What am I doing wrong?

0

There are 0 answers