Link to home
Start Free TrialLog in
Avatar of Kathryn77
Kathryn77

asked on

How to add a javascript confirm to a checkbox with a checkedChange event

I have a checkbox that I need to add a client side confirm before firing the checkedChanged event. THe problem is that the checked change event is not firing after the javascript.  Currently I don't have the CheckedChanged event doing anything, I just have a breakpoint making sure it gets there.

Thanks!

Here is my code:

On my webpage:
 
<asp:CheckBox ID="chkAllData" Text="All Information Has Been Entered" 
runat="server" AutoPostBack="True" CausesValidation="False" />
 
In the page load:
 Me.chkAllData.Attributes.Add("onclick", "return confirm('Are you sure you want to delete?');")
 
Then the CheckedChanged method:
Protected Sub chkAllData_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAllData.CheckedChanged
  If AccidentID.Value <> "" Then
  End If
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ororiole
ororiole
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kathryn77
Kathryn77

ASKER

Thanks so much, that worked perfectly!!!