简体   繁体   中英

how to show msg box if user forgot to check asp.net checkbox control on button click ..?

i have 20 checkboxes in usercontrol ... i wanna do whole coding in user control ...

how to show msg box if user forgot to check asp.net checkbox control on button click .. ?

You should provide a CustomValidator for every Checkbox which validates on client- and serverside if the Checkbox is checked. http://www.joe-stevens.com/2009/08/12/using-the-customvalidators-clientvalidationfunction/

Create a public method on the user control that returns a boolean indicating if the data entry in the control is correct. Call that method from your page on the button click event. If data entry is valid, continue processing;else show an error message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM