<%@ Register TagPrefix="CustomValidators" Namespace="CustomValidators"
Assembly="filename_of_DLL_file" %>
<HTML>
<body>
<form runat="server">
<asp:CheckBoxList id="CBList" runat="server">
<asp:ListItem Value="Hello" />
<asp:ListItem Value="World!" />
</asp:CheckBoxList>
<CustomValidators:RequiredFieldValidatorForCheckBoxLists
id="reqCBList" runat="server" ControlToValidate="CBList"
ErrorMessage="Please select at least one checkbox..." />
<asp:Button id="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
</form>
</body>
</HTML>
<script language="vb" runat="server">
Sub btnSubmit_Click(sender as Object, e as EventArgs)
If Page.IsValid then
Response.Write("<i>You have selected at least one checkbox!</i>")
End If
End Sub
</script>
|