1

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 3

3

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).

Sign up to request clarification or add additional context in comments.

Comments

3

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

I think this clarifies the OP's doubt very succinctly. +1
-1

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.

3 Comments

I see why someone has downvoted you... the example you link to uses the RangeValidator to compare date types, not string types.
thanks for down vote for my simple example to help Yagnesh84.
@Cerebus: my example says substitute the min & max values as well as type as per my answer. So I see why you don't answer questions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.