<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>