Below is the server side code snippet I am using:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
string confirmValue = Request.Form["confirm_value"];
if (confirmValue == "Yes")
{
UserId = Convert.ToInt32(Request.QueryString["UserId"]);
ProgramSrNno = Convert.ToInt32(Request.QueryString["ProgramSrNo"]);
UpdateAcknowledment(UserId, ProgramSrNno);
}
}
}
And this is my javascript code snippet:
window.onload = Confirm();
function Confirm() {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
if (confirm("Do you want to Acknowledge?")) {
confirm_value.value = "Yes";
} else {
confirm_value.value = "No";
}
document.forms["frmAcknowledgement"].appendChild(confirm_value);
}
I am looking for a way to make the dialog box appear first, and based on the user's selection, trigger the page load event accordingly. Currently, the page load event is firing before the JavaScript code.