Using CustomValidator to Validate a Checkbox
If you’ve ever tried to use the RequiredFieldValidator on a CheckBox control in ASP.NET, you’ve probably seen the following error:
Control … referenced by the ControlToValidate property of … cannot be validated.
Since there is no built-in validator for the CheckBox control, we have to custom make one. This would apply to the CheckBoxList as well.
Server-Side Validation
Below is an example of confirming whether a checkbox has been checked on the server-side.
<%@ Page Language="C#" %>
Client-side Validation
Below is an example of confirming whether a checkbox has been checked using client-side code.
<%@ Page Language="C#" %>



whn i m using custom validator for checkbox and try to check whethe it is checked or not.. it gives me error like…
“Control ‘chkTermServices’ referenced by the ControlToValidate property of ‘cvTermServices’ cannot be validated”
i hv written following code..
function checkTermsServices(source, args)
{
args.IsValid = document.getElementById(“”).checked;
}
where i m wrong ? do u any idea.. thn let me know abt cause of error…
Happy Programming
Sandeep Ramani