Client-side Validation for CheckBox and CheckBoxList
Unfortunately, ASP.NET 2.0 did not provide any validation controls for validating the status of a CheckBox . These controls are among the controls I use most often in several web applications. Typical uses include when you need the user to choose at least x number of items in a CheckBoxList or a user needs to agree to some terms by checking that he or she read the agreement.
This article by Scott Mitchell has a great overview of how to create such a validation control and the source is available at the end so you can start using it in your application immediately.
The usage is extermely simple. For example, I needed to make sure that the user selected at least one checkbox before submitting a search. Here's the markup:
<skm:CheckBoxListValidator ID="chklistVal" ValidationGroup="search" ControlToValidate="chkServices"
runat="server" Display="None" ErrorMessage="Please select at least one service." />