0% found this document useful (0 votes)
11 views8 pages

15,14,13,12 Asp PRG

Uploaded by

krupa pipaliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

15,14,13,12 Asp PRG

Uploaded by

krupa pipaliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Validation of email format using regular expression

 W15,aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="w15.aspx.cs"
Inherits="w15" %>

<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Label1" runat="server" Text="Enter email"></asp:Label>


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="TextBox1" ErrorMessage="EMail must be in proper
format"
ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\
w+)*"></asp:RegularExpressionValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>

 W15.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class w15 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

Validation of age using range validator


 W14.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="w14.aspx.cs"
Inherits="w14" %>

<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Label1" runat="server" Text="enter age"></asp:Label>


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="enter age between 18 to
25"
ForeColor="Red" MaximumValue="25"
MinimumValue="18"></asp:RangeValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />

</div>
</form>
</body>
</html>

 W14.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class w14 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

Validation of password and confirm password using compare


validator
 W13.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="w13.aspx.cs"
Inherits="w13" %>

<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Label1" runat="server" Text="Password"></asp:Label>


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Label ID="Label2" runat="server" Text="Confirm
Password"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="TextBox1" ControlToValidate="TextBox2"
ErrorMessage="Password and confirm password must be same"
ForeColor="Red"></asp:CompareValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" />

</div>
</form>
</body>
</html>

 W13.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class w13 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

Validation of username and password using required field


validator
 W12.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="w12.aspx.cs"
Inherits="w12" %>

<!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></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Label1" runat="server" Text="UserName"></asp:Label>


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox1" ErrorMessage="Must Enter username"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<asp:Label ID="Label2" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="TextBox2" ErrorMessage="Must enter Password"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Button"
ForeColor="#FF3300" />

</div>
</form>
</body>
</html>
 W12.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class w12 : System.Web.UI.Page


{
protected void Page_Load(object sender, EventArgs e)
{

You might also like