CustomValidator使用方法

<script language="javascript">
function CheckLength10(source, arguments)
{
 var lngMaxLength;
 
 lngMaxLength = 10;
 
 if (arguments.Value.length <= lngMaxLength)
 {
  arguments.IsValid = true;
 }
    else
    {
  arguments.IsValid = false;
 }
}

</script>

     <asp:CustomValidator ID="valComments" runat="server" ClientValidationFunction="CheckLength10"
                        ControlToValidate="tagkey" ErrorMessage="输入字符必须小于10个"></asp:CustomValidator>

你可能感兴趣的:(Validator)