Soby Web Components

Numeric Validator

This example demonstrates how to use numeric validator in the Soby Validator.
"sobyValidate.GetValidator" method takes one parameter. The parameter is the type of the validator. This method returns the validator for the given type. "Validate" method of the validator, returns as invalid if the given value is not a numeric value. It returns as valid if the given value is a numeric value.

 var textValidator = sobyValidate.GetValidator(soby_ValidatorTypes.Text);
 textValidator.MinLength = 10;
 textValidator.MaxLength = 20;
textValidator.Validate("Hello");
Output:false
textValidator.Validate("Hello World text");
Output:true
textValidator.Validate("Hello World long long long text");
Output:false

View source