The CheckBox control is required for user verification. the checkbox control is required.
The CheckBox control, because its value is select and non-select. Therefore, when submitting data, users must select CheckBox. In normal cases, verification is not recommended.
However, we can use asp: mmvalidator for verification, but we have to write custom Javascript code for verification. For details, refer to the following:
Function ValidateCheckBox (sender, args) {var checkbox = document. getElementById ("<% = CheckBox1.ClientID %>") if (checkbox. checked) {args. isValid = true;} else {args. isValid = false ;}}
1 <asp: CheckBox ID = "CheckBox1" runat = "server"/> 2 <asp: customValidator ID = "CustomValidator1" runat = "server" ErrorMessage = "required option" ForeColor = "Red" ClientValidationFunction = "ValidateCheckBox"> </asp: customValidator> <br/> 3 <asp: Button ID = "Button1" runat = "server" Text = "Submit"/>