Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display confirmation message when a checkbox is clicked

Tags:

c#

asp.net

I want to be able to display a confirmation message when asp.net checkbox is clicked, i tried using:

OnClientClick = "return confirm('Are you sure you want to logout?')"

It doesnt report error, but not working, i later found out that asp.net checkbox doen't have OnClientClick attribute.

I have also done a few research on google still couldn't achieve! Please does anyone know how to do this? Thanks in advance.

like image 738
JPeter Avatar asked Apr 13 '15 14:04

JPeter


1 Answers

After much research i was able to implement this, here is the answer so other users who are facing this same issue can use it:

OnClick="if(!confirm('Are you sure you want to sign out?'))return false;"
this works perfectly for me.
like image 94
JPeter Avatar answered Sep 21 '22 21:09

JPeter