<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Validation Summery in Asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<table cellpadding="0" cellspacing="0">
<tr>
<td >Full Name<span style="color:#DA251C">*</span></td>
<td><asp:TextBox ID="TextBox1" runat="server" MaxLength="25" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter Name" ForeColor="#DA251C" ControlToValidate="TextBox1" Display="none" CssClass="validation" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="TextBox1" ValidationExpression="^[a-z A-Z]*$" ErrorMessage="Invalid Name , Numeric is not allowed" ForeColor="#DA251C" CssClass="validation" Display="none"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td >Contact no<span style="color:#DA251C">*</span></td>
<td><asp:TextBox ID="TextBox5" runat="server" MaxLength="10" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Enter Contact" ForeColor="#DA251C" ControlToValidate="TextBox5" Display="none" CssClass="validation" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="rg" runat="server" ControlToValidate="TextBox5" ValidationExpression="^[0-9]{10}$" ErrorMessage=" Invalid No. " ForeColor="#DA251C" Display="none" CssClass="validation" ></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td >E-mail <span style="color:#DA251C">*</span></td>
<td><asp:TextBox ID="TextBox6" runat="server" MaxLength="25" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Enter Email" ForeColor="#DA251C" ControlToValidate="TextBox6" Display="none" CssClass="validation" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid E-mail" ForeColor="#DA251C" ControlToValidate="TextBox6" ValidationExpression="^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$" CssClass="validation" Display="none" ></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td colspan="2">
<div style="display:none">
<asp:ValidationSummary ID="vs" runat="server" ShowMessageBox="true" />
</div>
</td></tr>
<tr><td colspan="2"><asp:Button ID="btn" runat="server" Text="Submit" /></td></tr>
</table>
</form>
</body>
</html>
<head runat="server">
<title>Validation Summery in Asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<table cellpadding="0" cellspacing="0">
<tr>
<td >Full Name<span style="color:#DA251C">*</span></td>
<td><asp:TextBox ID="TextBox1" runat="server" MaxLength="25" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter Name" ForeColor="#DA251C" ControlToValidate="TextBox1" Display="none" CssClass="validation" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="TextBox1" ValidationExpression="^[a-z A-Z]*$" ErrorMessage="Invalid Name , Numeric is not allowed" ForeColor="#DA251C" CssClass="validation" Display="none"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td >Contact no<span style="color:#DA251C">*</span></td>
<td><asp:TextBox ID="TextBox5" runat="server" MaxLength="10" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Enter Contact" ForeColor="#DA251C" ControlToValidate="TextBox5" Display="none" CssClass="validation" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="rg" runat="server" ControlToValidate="TextBox5" ValidationExpression="^[0-9]{10}$" ErrorMessage=" Invalid No. " ForeColor="#DA251C" Display="none" CssClass="validation" ></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td >E-mail <span style="color:#DA251C">*</span></td>
<td><asp:TextBox ID="TextBox6" runat="server" MaxLength="25" ></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Enter Email" ForeColor="#DA251C" ControlToValidate="TextBox6" Display="none" CssClass="validation" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid E-mail" ForeColor="#DA251C" ControlToValidate="TextBox6" ValidationExpression="^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z][a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$" CssClass="validation" Display="none" ></asp:RegularExpressionValidator>
</td>
</tr>
<tr><td colspan="2">
<div style="display:none">
<asp:ValidationSummary ID="vs" runat="server" ShowMessageBox="true" />
</div>
</td></tr>
<tr><td colspan="2"><asp:Button ID="btn" runat="server" Text="Submit" /></td></tr>
</table>
</form>
</body>
</html>
No comments:
Post a Comment