range_validator.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="range_validator.aspx.cs" Inherits="our_program.range_validator" %>
<!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>Range validator</title>
<center><h1>Range validator</h1></center>
<script runat="server">
void btnclick(Object sender, EventArgs e)
{
if (Page.IsValid)
{
lbl.Text = "entered value is between 1 and 100 Page is valid.";
}
else
{
lbl.Text="entered value is between 1 and 100 Page is not valid!!";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<br />
<br />
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="RangeValidator" MaximumValue="100" MinimumValue="1" ControlToValidate="txt1" Type="Integer" EnableClientScript="false" Text="please enter value between 1 and 100"></asp:RangeValidator>
<asp:Label ID="lbl" runat="server" Text=""></asp:Label>
<br />
<br />
<asp:Button ID="btn" runat="server" Text="submit" OnClick="btnclick"/>
</div>
</center>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="range_validator.aspx.cs" Inherits="our_program.range_validator" %>
<!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>Range validator</title>
<center><h1>Range validator</h1></center>
<script runat="server">
void btnclick(Object sender, EventArgs e)
{
if (Page.IsValid)
{
lbl.Text = "entered value is between 1 and 100 Page is valid.";
}
else
{
lbl.Text="entered value is between 1 and 100 Page is not valid!!";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<br />
<br />
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="RangeValidator" MaximumValue="100" MinimumValue="1" ControlToValidate="txt1" Type="Integer" EnableClientScript="false" Text="please enter value between 1 and 100"></asp:RangeValidator>
<asp:Label ID="lbl" runat="server" Text=""></asp:Label>
<br />
<br />
<asp:Button ID="btn" runat="server" Text="submit" OnClick="btnclick"/>
</div>
</center>
</form>
</body>
</html>
range_validator.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace our_program
{
public partial class range_validator : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
No comments:
Post a Comment