The RangeValidator Server Control in asp.net


The RangeValidator Server Control:

The RangeValidator control is quite similar to that of the CompareValidator control, but it makes sure that the end user value or selection provided is between a specified range as opposed to being just greater than or less than a specified constant. For an example of this, go back to the text-box element that asks for the age of the end user and performs a validation on the value provided.

 

Using the RangeValidator control to test an integer value

Age:

<asp:TextBox ID=”TextBox1″ Runat=”server”></asp:TextBox>

  &nbsp;

<asp:RangeValidator ID=”RangeValidator1″ Runat=”server”

  ControlToValidate=”TextBox1″ Type=”Integer”

  ErrorMessage=”You must be between 30 and 40″

  MaximumValue=”40″ MinimumValue=”30″></asp:RangeValidator>

Other Related Posts:

Validations:

ASP.NET Validation Server Controls

The RequiredFieldValidator Server Control in asp.net

Validating Drop-Down Lists with the RequiredFieldValidator Control

The CompareValidator Server Control in asp.net

The RangeValidator Server Control in asp.net

The RegularExpressionValidator Server Control in asp.net

The CustomValidator Server Control in asp.net

The ValidationSummary Server Control in asp.net

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s