[go: up one dir, main page]

0% found this document useful (0 votes)
35 views2 pages

Validation Controls Code

This document is an ASP.NET web form for user registration, including fields for name, email, age, password, and address. It features validation controls to ensure that the name is entered, the email is properly formatted, the age is between 20 and 30, and that the password and confirmation match. The form includes a 'Register' button for submission.

Uploaded by

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

Validation Controls Code

This document is an ASP.NET web form for user registration, including fields for name, email, age, password, and address. It features validation controls to ensure that the name is entered, the email is properly formatted, the age is between 20 and 30, and that the password and confirmation match. The form includes a 'Register' button for submission.

Uploaded by

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

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SignUpForm.aspx.

cs"
Inherits="SignUpForm" %>

<!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>
<style type="text/css">
.style1
{
height: 47px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border=2 width=100% bgcolor="eeeee">
<tr>
<td colspan=2 height=40px align=center >
<h2>
<strong><em>User Registeration Form</em></strong></h2>
</td>
</tr>

<tr>
<td width=30% class="style1">Name</td>
<td class="style1">
<asp:TextBox ID="txtName" runat="server" Width="605px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtName" ErrorMessage="Name must be Entered"
SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>

<tr>
<td width=30% height=40px>Email Address</td>
<td>
<asp:TextBox ID="txtEmail" runat="server" Width="604px"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="txtEmail" ErrorMessage="Enter the Proper Email
Address"
SetFocusOnError="True"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+
([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>

<tr>
<td width=30% height=40px>Age</td>
<td>
<asp:TextBox ID="txtAge" runat="server" Width="607px"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="txtAge" ErrorMessage="Age between 20 to 30"
MaximumValue="30" MinimumValue="20"
SetFocusOnError="True"></asp:RangeValidator>
</td>
</tr>

<tr>
<td width=30% height=40px>Password</td>
<td>
<asp:TextBox ID="txtPassword" runat="server" Width="604px"
TextMode=Password></asp:TextBox>
</td>
</tr>

<tr>
<td width=30% height=40px>Confir Password</td>
<td>
<asp:TextBox ID="txtConfirm" runat="server" Width="604px"
TextMode=Password></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="txtPassword" ControlToValidate="txtConfirm"
ErrorMessage="Password Must be Same"
SetFocusOnError="True"></asp:CompareValidator>
</td>
</tr>

<tr>
<td width=30% height=40px>Address</td>
<td>
<asp:TextBox ID="txtAddress" runat="server" Width="603px"></asp:TextBox>
</td>
</tr>

<tr>
<td colspan=2 height=40px>
<asp:Button ID="txtRegister" runat="server" Text="Register" Width="207px"
style="text-align: center" />
</td>
</tr>

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

You might also like