---
title: "RangeValidator Control in ASP.Net"  
description: "The RangeValidator Server Control makes sure that the entered user value or selection provided is between a specified ranges.It is possible to check r"  
author: "Pushpendra Singh"  
published: 2010-11-09  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/196/rangevalidator-control-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# RangeValidator Control in ASP.Net

The [RangeValidator](https://www.mindstick.com/forum/33885/how-to-use-rangevalidator-in-asp-dot-net) Server Control makes sure that the entered user value or [selection](https://www.mindstick.com/blog/60/populate-records-in-second-listbox-according-to-the-selection-in-first-list-box) provided is between a specified ranges.It is possible to check ranges within numbers, dates, and characters.\

The validation will not fail if the input control is empty. Use the RequiredFieldValidator control to make the field required.

```
<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="RangeValidator"></asp:RangeValidator>
```

**[Properties](https://yourviews.mindstick.com/view/81845/now-it-s-possible-to-predict-properties-of-any-molecule):**

| ControlToValidate | The id of the control to [validate](https://www.mindstick.com/forum/1490/what-is-better-solution-for-validate-form-textboxs-value) |
| --- | --- |
| [Error Message](https://www.mindstick.com/forum/23174/error-message-the-page-you-are-requesting-cannot-be-served-because-of-the-extension-configuration) | The text to display in the page when [validation fails](https://www.mindstick.com/forum/34291/how-to-raise-a-callback-when-asp-dot-net-mvc-client-validation-fails) |
| [Maximum Value](https://answers.mindstick.com/qa/38240/according-to-recent-rbi-directives-to-banks-how-many-pieces-of-soiled-currency-notes-with-a-maximum-value-of-rs-5-000-can-be-exchanged-at-banks-free-of-charge) | Specifies the maximum value of the input control |
| Minimum Value | Specifies the minimum value of the input control |
| Type | Specifies the data type of the value to check. The types are: <![if !supportLists]> · <![endif]>[Currency](https://yourviews.mindstick.com/view/81622/fake-currency-issue-is-back-for-indian-government) <![if !supportLists]> · <![endif]>Date <![if !supportLists]> · <![endif]>Double <![if !supportLists]> · <![endif]>Integer <![if !supportLists]> · <![endif]>String |

**Code:**

```
<asp:Label ID="Label1" runat="server" Text="NO OF Item"></asp:Label><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  <asp:RangeValidator ID="RangeValidator1" runat="server"    ControlToValidate="TextBox1" ErrorMessage="range should be between 5 to 10"    MaximumValue="10" MinimumValue="5" SetFocusOnError="True" Type="Integer"></asp:RangeValidator><asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="SUBMIT" />
```

When we will not enter value in the [specified range](https://www.mindstick.com/forum/160084/describe-the-sql-between-operator-how-it-can-be-used-to-search-for-data-within-a-specified-range) then error message will show

![RangeValidator Control in ASP.Net](https://www.mindstick.com/mindstickarticle/e5f8e5c6-f02f-4372-904e-5111e20ca768/images/765230da-74c8-49f1-bc47-4d547fb11fc9.png)

When we enter the value in the specified range then page will execute

![RangeValidator Control in ASP.Net](https://www.mindstick.com/mindstickarticle/e5f8e5c6-f02f-4372-904e-5111e20ca768/images/e2fcdbde-4ff9-4990-88f0-eb8320b5fd0e.png)

---

Original Source: https://www.mindstick.com/articles/196/rangevalidator-control-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
