Click here to Skip to main content
15,891,939 members
Articles / Programming Languages / C#

Using Custom Validator to Validate Checkbox

Rate me:
Please Sign up or sign in to vote.
4.55/5 (5 votes)
30 Oct 2007CPOL2 min read 71.3K   431   13  
Performing validation of checkbox using custom validator
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="SS.Web.UI.Controls" Namespace="SS.Web.UI.Controls"  TagPrefix="SS"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:ValidationSummary ID="vldsum" runat="server" />
      <SS:CheckBoxControl ID="chk1" runat="server" Caption="Check box 1" Validate="true" Checked="true" ErrorMessage="you need to uncheck this b4 completing this operation"/>
      <SS:CheckBoxControl ID="CheckBoxControl1" runat="server" Caption="Check box 2" Validate="true" />
      <asp:Button ID="btnSubmit" runat="server" Text="submit" />
    </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
Web App Developer, Chennai, India

Comments and Discussions