I am attempting to display a confirmation popup when the selected value of a radiobuttonlist is changed to a certain value, and only perform some statements if Ok is pressed. I get the popup to display, but the program processes the SelectedIndexChanged whether I press Ok or Cancel.
When I display my data record, I add the attribute if the radiobuttonlist is 1 value, as follows.
I also tried "OnSelectedIndexChanged", but then the popup is not displayed at all.
I have AutoPostBack set to True for the radiobuttonlist. Here is my code for the SelectedIndexChanged of the radiobuttonlist.
What am I doing wrong?
Thanks,
Andrea
When I display my data record, I add the attribute if the radiobuttonlist is 1 value, as follows.
Code:
rblShipMethod.Attributes.Add("OnClick", "javascript:return confirm('Are you sure you want to change the shipping method?');")
I have AutoPostBack set to True for the radiobuttonlist. Here is my code for the SelectedIndexChanged of the radiobuttonlist.
Code:
Private Sub rblShipMethod_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rblShipMethod.SelectedIndexChanged
Select Case rblShipMethod.SelectedValue
Case "LTL"
'Do something
rblShipMethod.Attributes.Clear()
Case "Truckload"
'Do something esle
rblShipMethod.Attributes.Add("OnClick", "javascript:return confirm('Are you sure you want to change the shipping method?');")
End Select
End Sub
Thanks,
Andrea