In Rangevalidator one Property is Type in this Property String is available Please give me exact example of that how can we used it...
3 Answers
The MSDN page for RangeValidator seems clear enough:
The
RangeValidatorcontrol uses four key properties to perform its validation. TheControlToValidateproperty contains the input control to validate. TheMinimumValueandMaximumValue properties specify the minimum and maximum values of the valid range.The
BaseCompareValidator.Typeproperty is used to specify the data type of the values to compare. The values to compare are converted to this data type before the validation operation is performed.
The page for BaseCompareValidator.Type has an example of its use (for a CompareValidator, but it should show you enough).
Comments
For comparing strings use Regularexpressionvalidator instead of Rangevalidator.
In case of type string for the range validator it will only check the character by character, not the length of the string.
Eg:
I have set the range for the range validator for the type string is Minimum Value To 'A' And maximum value to 'z' (small z) then it will check whether the input character is within the range of minimum and maximum value.
1 Comment
To validate say a number plate range for a certain cities in a state - range CA* - CE*
Substitue the following:
Type : String
MinimumValue = "CA*"
MaximumValue = "CF*"
use this within a standard example, as found at http://www.w3schools.com/aspnet/showasp.asp?filename=demo_rangevalidator
Thats example of range validation for string.