<%@ Page language="c#" Codebehind="ApplyCustomValidator.aspx.cs" AutoEventWireup="false" Inherits="ApplyCustomValidator.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
	</HEAD>
	<body>
		<h3><font face="宋体">CustomValidator 示例</font></h3>
		<form id="Form1" runat="server">
			<asp:label id="lblOutput" runat="server" Font-Size="10.5pt" Font-Name="宋体" Text="输入一个偶数:"></asp:label><br>
			<p><asp:textbox id="Text1" runat="server"></asp:textbox>&nbsp;&nbsp;
				<asp:customvalidator id="CustomValidator1" runat="server" Font-Size="10pt" Font-Name="verdana" Display="Static" ControlToValidate="Text1" ClientValidationFunction="ClientValidation">
           不是偶数！
    </asp:customvalidator></p>
			<p><asp:button id="ValidatorBtn" runat="server" text="验证"></asp:button></p>
		</form>
		<P><FONT face="宋体"></FONT></P>
		<script language="javascript">
    function ClientValidation( source,value )
    {
        var num = value.Value;
        if( num%2 == 0 )
			value.IsValid = true;
        else
			value.IsValid = false;
    }
		</script>
	</body>
</HTML>
