Validation CSS In ASP.NET
ASPX PAGE :-
<table cellpadding="0" cellspacing="30" >
<tr>
<td>
First Name:
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" CssClass="triangle-border left" ErrorMessage="FirstName Required"
ControlToValidate="TextBox1" ValidationGroup="submit"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
ValidationExpression="[a-zA-Z\s]+" CssClass="triangle-isosceles left" ErrorMessage="FName should be alphabetical"
Display="Dynamic" EnableClientScript="true"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
Last Name:
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server" CssClass="triangle-border left" ErrorMessage="Last Name required"
ControlToValidate="TextBox2" ValidationGroup="submit"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBox2"
ValidationExpression="[a-zA-Z\s]+" ErrorMessage="LName should be alphabetical"
CssClass="triangle-isosceles left" Display="Dynamic" EnableClientScript="true"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Submit" ValidationGroup="submit" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Font-Bold="true" />
</td>
</tr>
</table>
ASPX PAGE :-
<table cellpadding="0" cellspacing="30" >
<tr>
<td>
First Name:
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" CssClass="triangle-border left" ErrorMessage="FirstName Required"
ControlToValidate="TextBox1" ValidationGroup="submit"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox1"
ValidationExpression="[a-zA-Z\s]+" CssClass="triangle-isosceles left" ErrorMessage="FName should be alphabetical"
Display="Dynamic" EnableClientScript="true"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
Last Name:
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server" CssClass="triangle-border left" ErrorMessage="Last Name required"
ControlToValidate="TextBox2" ValidationGroup="submit"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="TextBox2"
ValidationExpression="[a-zA-Z\s]+" ErrorMessage="LName should be alphabetical"
CssClass="triangle-isosceles left" Display="Dynamic" EnableClientScript="true"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Submit" ValidationGroup="submit" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Font-Bold="true" />
</td>
</tr>
</table>
No comments:
Post a Comment