Javascript disabling my postback

Posted by LoveMeSomeCode on Stack Overflow See other posts from Stack Overflow or by LoveMeSomeCode
Published on 2010-06-03T21:33:10Z Indexed on 2010/06/03 21:44 UTC
Read the original article Hit count: 307

Filed under:
|

I have an ASP.NET checkbox, and I want to run some javascript before it posts back.

Something like:

<asp:CheckBox ID="chkSelected" runat="server" AutoPostBack="True" OnCheckedChanged="chkSelected_CheckedChanged" />

but I want to run a JS confirm dialog when the user click it, and if they were UNCHECKING it, I'd like to ask them if they're sure, and if so, postback and run my serverside code. If they say No, don't postback at all.

Anyone know of an 'easy' way to do this?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript