I'm trying to call a JavaScript function with a popup. If user click on "Ok", it calls a C# function. In my case, the pop up is functioning but when I click "Ok" it not redirect to C# function. How to fix this?
function Confirm() {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
var noTel = document.getElementById("offcell").value;
var msg = document.getElementById("textarea-1").value;
alertify.confirm('PREVIEW MESSAGE', "To:" + noTel + "
Message:" + msg, function (e) {
Message:" + msg, function (e) {
confirm_value.value = "Yes";
document.forms[0].appendChild(confirm_value);
//__doPostBack('sms');
}, null).set('labels', { ok: 'Confirm', cancel: 'Cancel' });
}
The button that call JavaScript:
The C# function :
protected void Button1_Click(object sender, EventArgs e)
{
if (Request.Form["confirm_value"] == "Yes")
{
Response.Redirect("Default.aspx");
//ClientScript.RegisterStartupScript(this.GetType(), "script", "document.location.href='/default.aspx';", true);
}
}
Hiten PandyaPosted Mar 15, 2018, 11:24 PM
Jieha LeePosted Mar 16, 2018, 1:28 AM