Firstly add following script in head section:
<script type="text/javascript">
function MinLength(sender, args) {
args.IsValid = (args.Value.length == 10);
}
</script>
This script is for setting minimum length to 10
Now add custom validator as:
<asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtMobile" CssClass="error" ErrorMessage="Invalid" ClientValidationFunction="MinLength"></asp:CustomValidator>
No comments:
Post a Comment