title: custom validator for checkbox in asp.net
body: <p>i have used custom validator </p>
  
  <pre><code> protected void cvIsActive_ServerValidate(object source,ServerValidateEventArgs args)
          {
              if(args.Value.Length==1)
                  args.IsValid = true;
              else
                  args.IsValid = false;
          }       
  </code></pre>
  
  <p>this is code for server validate.. i have written to check whether its checked or not.
  i have taken control to validate as checkbox</p>
  
  <pre><code>&lt;asp:CustomValidator runat="server" ErrorMessage="Please Select Status" 
              ID="cvIsActive" Font-Size="Smaller" 
              onservervalidate="cvIsActive_ServerValidate" ControlToValidate="chkIsActive"&gt;&lt;/asp:CustomValidator&gt;
  </code></pre>
  
  <p>but as soon as page loads it giving error</p>
  
  <pre><code>Control 'chkIsActive' referenced by the ControlToValidate property of 'cvIsActive' cannot be validated. 
  </code></pre>