I have created a confirmation box that works as expected and return true/false on the button click. But it is a general confirm
where I cannot set a custom title.
function Validate() {
if ($('#cphBody_gvBins').find("input[value='Edit']").length > 0 || $('#cphBody_gvBins').find("input[value='Update']").length > 0 ) {
var mConfirm = confirm("The Record contains data that will be deleted. Do you still want to proceed?");
return mConfirm;
}
}
I call it on a client event. The function returns true or false.
<asp:Button ID="btnIssuerRemove" runat="server" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
CausesValidation="false" CommandName="Remove" Text="Remove" OnCommand="issuerCommand_Click" OnClientClick="return Validate()"/>
But, it is just a regular confirmation box.
So, I went ahead and created a div:
<div id="dialogBox">
Are you sure?
</div>
And then I changes the function to display my div
as a dialog:
function CheckForBins() {
if ($('#cphBody_gvBins').find("input[value='Edit']").length > 0 || $('#cphBody_gvBins').find("input[value='Update']").length > 0) {
//var mConfirm = confirm("The issuer contains Bins that will be deleted. Do you still want to proceed?");
$("#dialogBox").dialog({
title: "System Message",
modal: true,
resizable: false,
width: 250,
buttons: {
Cancel: function () {
$(this).dialog('close');
},
OK: function(){
$(this).dialog('close');
}
}
});
return false;
}
}
Now, with that set up, when I click the "Remove" button, dialog is displayed. However, it does not do anything on "OK"
How can I return true/false from here, so, I do not delete the record when "Cancel" is pressed and "Delete" when "OK" is pressed.