Rather than creating your own custom control, an easier way would be to just
drop a custom validator control on your page and use it's Server_Validate
event to check the lengths of your strings.
private void vldOrder_ServerValidate( Object source,
ServerValidateEventArgs args)
{
if (txtZip.Text.Length < 5 || txtZip.Text.Length > 9){
args.IsValid = false;
vldOrder.ErrorMessage = "Zip/Postal Code must be between 5 and 9
characters long";
return;
}
}
HTH
"Mike Moore" wrote:
Does anyone have a good example of a custom validator for max and min length
validation?