I have following code in my .aspx
<td>
<script type="text/javascript" language="javascript">\
function ShowConfirm() {
if (confirm("Are you sure?") == true)
return true;
else
return false;
}
</script>
<asp:DropDownList ID="ddl1s" runat="server"
onselectedindexchanged="ddl1_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
</td>
I have following code in my aspx.cs
protected void ddlEnrollmentStatus_SelectedIndexChanged(object sender, EventArgs e)
{
ddl1.Attributes.Add("onchange", "ShowConfirm();");
}
I have two items in my dropdownlist (Yes and No)
When I select 2nd item from the list, my page refreshes and I get w/e I set up in Page_Load event.
What am I doing wrong? I am trying to create a confirmbox where it asks user to verify if the value they selected is what they intended to select. If they press Yes, change the value to w/e they selected. if they press no, revert back to original value.