How to use RangeValidator in asp.net

Total Post:341

Points:2389
 752  View(s)
Ratings:
Rate this:
I want to use RangeValidator in asp.net how to use please help me
  1. Post:281

    Points:2003
    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 Apr-11-2018 12:25:27 AM

Answer