Thursday 20 June 2013

Widgets

Range Validator on Text Change Error Message in Asp.net Validation

Description:- In Asp.net Validation Now we started to cover All Validations used in Asp.net.In my previous Articles We done Email and Phone Number , Web Url Address Validation. Now in this Article We Describe How to use Range Validator Between Two values.So My friends here is the Demo How The Code Works..


Demo:-



Coding:- 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Label ID="lblNum" runat="server">Enter age Between 18 to 28</asp:Label>
   
    &nbsp;&nbsp;&nbsp;
   
    <asp:TextBox ID="txtage" runat="server" ></asp:TextBox>
    <asp:RangeValidator runat="server" ID="rgvtxtage" ErrorMessage="Please Enter Age Between 18 to 28" MinimumValue="18" MaximumValue="28" Type="Integer" ControlToValidate="txtage"></asp:RangeValidator>
   
   
    </div>
    </form>
</body>
</html>

0 comments:

Post a Comment