home / software / tips and tricks / Required field for ASP.NET Checkbox

Required field for ASP.NET Checkbox

Updated:  07/01/2012 12:07 PM
Author:  Shiju Mathews

Status:    Resolved.


In situation where we need to make sure that the user need to check a check box, asp.net asp:RequiredFieldValidator is not going help you. Client side validation alone can be done suing Javascript. Likewise server validation alone can be done using code behind.
Using a CustomValidator we can implement both sides of validation along with built in business rules. The implementation is as follows.



Implement the OnServerValidate event using function 'ValidateUserAgr' on code behind.


Also implement the ClientValidation using "ClientValidate" on javascript.


Tags: Required field for ASP.NET Checkbox
Updated on: April 2024