Yagnesh84
Yagnesh84

Reputation: 157

Range validator

In Rangevalidator one Property is Type in this Property String is available Please give me exact example of that how can we used it...

Upvotes: 1

Views: 2085

Answers (3)

rahul
rahul

Reputation: 187110

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.

Upvotes: 3

Forer
Forer

Reputation: 1055

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.

Upvotes: -1

AakashM
AakashM

Reputation: 63378

The MSDN page for RangeValidator seems clear enough:

The RangeValidator control uses four key properties to perform its validation. The ControlToValidate property contains the input control to validate. The MinimumValue and MaximumValue properties specify the minimum and maximum values of the valid range.

TheBaseCompareValidator.Type property 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).

Upvotes: 3

Related Questions