I use LinkButton and DropDown.
When I click the LinkButton button, DropDown appears.
After selecting DropDown, I want a confirmation box from JavaScript to appear to change the value.
I call this script in the second if state, but it does not work.
After confirmation, I want to change another value and exit the condition.
protected void lnkbtnSave_Click(object sender, EventArgs e) { if ((ddlHiringManager.SelectedItem != null && (ddlHiringManager.SelectedItem.Text != lblHiringManager.Text)) && (Convert.ToInt32(ddlHiringManager.SelectedValue)) != -1) { if (ClientScript.RegisterStartupScript(typeof(Page), "Confirm", "<script type='text/javascript'>Confirm('Are you sure you want to change Hiring Manager for this requirement.');</script>")) { ClsClientManager objClientManager = new ClsClientManager(); if (objClientManager.UpdateHRManagerByReqID(Convert.ToInt32(hdnReqId.Value), Convert.ToInt32(ddlHiringManager.SelectedValue)) > 0) { lblShowHiringManager.Text = ddlHiringManager.SelectedItem.Text; } } } else { ClientScript.RegisterStartupScript(typeof(Page), "SymbolError", "<script type='text/javascript'>alert('Please Select Hiring Manager !');</script>"); } }
source share