Hi Jermaine,
You just need to add more if condition after first confirmation if condition. Refer the below code for your reference and implement it as per your code logic.
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function Confirm() {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
if (confirm("Do you want to save data?")) {
if (confirm("Are you sure want to save data?")) {
confirm_value.value = "Yes";
}
else {
confirm_value.value = "No";
}
} else {
confirm_value.value = "No";
}
document.forms[0].appendChild(confirm_value);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="btnConfirm" runat="server" OnClick="OnConfirm" Text="Raise Confirm"
OnClientClick="Confirm()" />
</form>
</body>
</html>
C#
public void OnConfirm(object sender, EventArgs e)
{
string confirmValue = Request.Form["confirm_value"];
if (confirmValue == "Yes")
{
// Here i just showing alert message box you can implement your code logic to perform your action.
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked YES!')", true);
}
else
{
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true);
}
}
VB.Net
Protected Sub OnConfirm(sender As Object, e As EventArgs)
Dim confirmValue As String = Request.Form("confirm_value")
If confirmValue = "Yes" Then
'Here i just showing alert message box you can implement your code logic to perform your action.
ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('You clicked YES!')", True)
Else
ClientScript.RegisterStartupScript(Me.[GetType](), "alert", "alert('You clicked NO!')", True)
End If
End Sub
Screenshot
