I have an asp.net website. I want to open a popup asking for user confirmation in code behind page.
I have a drop down with some values. "cancel ticket" is one of those values. So when user selects this item, I want to display a confirmation box asking user "Are you sure you want to cancel the ticket"?
I've tried some code using JavaScript,
HTML:
<asp:DropDownList ID="ddlStatus" runat="server" CssClass="selectstyle" DataTextField="Name" DataValueField="ID" onchange ="GetSelectedItem(this);" />
JavaScript :
<script type="text/javascript">
function GetSelectedItem(x) {
if (x.value == 4) {
return confirm("Are you sure you want to cancel support ticket ?");
}
}
which is displaying a popup as I want.
Now, I want to make a textbox and a label visible if user clicked on "OK" and reset dropdownlist if user clicked on "Cancel"