HOW TO USE RANGEVALIDATOR IN ASP.NET

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 422  View(s)
Ratings:
Rate this:
I want to use RangeValidator in asp.net how to use please help me
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to use RangeValidator in asp.net

    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">
        <title></title>
         <style>
          #rngsalary {
              color:#EF0000;
          }
      </style>
    </head>
     
    <body>

        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <div>
                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 />
            </div>
        </form>
    </body>
       
    </html>

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!