Source Code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default1.aspx.cs"
Inherits="ValidationPractical.default1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 170px;
}
.auto-style3 {
width: 170px;
height: 26px;
}
.auto-style4 {
height: 26px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<!DOCTYPE html>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 170px;
}
.auto-style3 {
width: 170px;
height: 26px;
}
.auto-style4 {
height: 26px;
}
.auto-style5 {
width: 63px;
}
</style>
<table class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Roll No."></asp:Label>
</td> <td>
<asp:TextBox ID="TextBoxRollNo" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorRollNo" runat="server"
ControlToValidate="TextBoxRollNo" ErrorMessage="Please Enter Roll No"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBoxName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorName" runat="server"
ControlToValidate="TextBoxName" ErrorMessage="Enter your Name"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Age"></asp:Label>
</td> <td>
<asp:TextBox ID="TextBoxAge" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorAge" runat="server"
ControlToValidate="TextBoxAge" ErrorMessage="Enter Your Age"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Email"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBoxEmail" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBoxEmail" ErrorMessage="Enter Valid Email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ForeColor="Red"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Password"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBoxPass" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorpass" runat="server"
ControlToValidate="TextBoxPass" ErrorMessage="Enter Your Password"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server" Text="Confirm Password"></asp:Label>
</td> <td>
<asp:TextBox ID="TextBoxCpass" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="TextBoxPass" ControlToValidate="TextBoxCpass"
ErrorMessage="Confirm Password" ForeColor="Red"></asp:CompareValidator>
</td>
</tr>
<tr>
<td class="auto-style3">
<asp:Label ID="Label7" runat="server" Text="Mobile No."></asp:Label>
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBoxMob" runat="server"></asp:TextBox> <asp:RegularExpressionValidator ID="RegularExpressionValidatorMob" runat="server" ControlToValidate="TextBoxMob" EnableTheming="True"
ErrorMessage="Enter Mobile No." ValidationExpression="(0( \d|\d ))?\d\d \d\d(\d \d| \d\d )\d\d" ForeColor="Red"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Register" Width="79px" />
<input id="Reset1" class="auto-style5" type="reset" value="reset" /></td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
0 Comments