Exforsys

Home arrow Technical Training arrow ASP.NET Training

Range Validator

Page 4 of 7
Author : Exforsys Inc.     Published on: 4th Mar 2005    |   Last Updated on: 18th Dec 2010

ASP .NET: Validating User Input with C#

The Range Validator control is used to check whether the input control contains value in the specified range. You can check the range of values against different data types such as String, Date, Integer and so on.

The two most important properties of the range validator control is the Maximum value and the minimum value. The range can be used when you need to restrict the user data.

Ads
Suppose you want the user to enter the number in the TextBox which is between 20 and 25 you can use range validator mimimum and maximum properties to restrict the user input.

Sample Code
  1. if(Page.IsValid == true)
  2. {
  3. RangeValidator1.MinimumValue = 20;
  4. RangeValidator1.MaximumValue = 25;
  5. }
Copyright exforsys.com




 
This tutorial is part of a ASP.NET Training tutorial series. Read it from the beginning and learn yourself.

ASP.NET Training

 

Comments