Dear Sir,
My code is not showing sweet alert after button click. sweet alert should confirmation (YES/NO). on click YES. I want to perform buttonclick event. and on NO alter should close.
like textbox1.text="YES CLICK"
Please help sir
HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AtestSweetAlertConfirmation.aspx.cs"
Inherits="AtestSweetAlertConfirmation" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Sweet Alert</title>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.css"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-sweetalert/1.0.1/sweetalert.min.css.map"></script>
<script>
var object = { status: false, ele: null };
function ConfirmMessage(ev) {
if (object.status) { return true; };
swal({
title: "Are you sure?",
text: "Process will not revert",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes, Process",
closeOnConfirm: true
},
function () {
object.status = true;
object.ele = ev;
object.ele.click();
});
return false
};
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="ConfirmMessage(this);"
OnClick="Button1_Click" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>