Home > DeveloperSection > Forums > How to use RangeValidator in asp.net
Ankit Singh

Total Post:341

Posted on    January-17-2016 10:34 PM

 ASP.Net ASP.Net  Validation 

 1 Reply(s)
 185  View(s)
Rate this:
I want to use RangeValidator in asp.net how to use please help me

aditya kumar Patel

Total Post:250

Posted on    January-17-2016 10:56 PM

The RangeValidator does exactly what the name implies; it makes sure that the user input is within a specified range. You can use it to validate both numbers, strings and number, we will try with a number.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RangeVailidation.aspx.cs" Inherits="Forumasp.RangeVailidation" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
      #rngsalary {

    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            Salary:<br />
            <asp:TextBox runat="server" ID="txtsalary" />
            <asp:RangeValidator runat="server" ID="rngsalary" ControlToValidate="txtsalary" Type="Integer" MinimumValue="100" MaximumValue="10000" ErrorMessage="Please Enter Vailid Salary Maximum 10000 and Minimum 100!" ClientIDMode="AutoID" />
            <br />
            <br />

Modified On Jan-27-2016 05:52:37 AM

Don't want to miss updates? Please click the below button!

Follow MindStick