Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 Validation on Gridview
Posted by self innovator on  12/9/2011 10:06:07 PM Category: Asp.Net 2.0
Add to my favorites
Email to friend
Anyone pls guide me how to make an alignment on Gridview validations(error messages) all should display in Common size withount any improper alignment.

Here My Code.
<asp:TemplateField HeaderText="EmpName">
<asp:Label ID="lblEmpName" runat="server" Text='<%#Eval("EmpName")%>'></asp:Label>
<asp:TextBox ID="txtNewEmpName" Width="50px" runat="server" Text='<%#Eval("EmpName") %>'></asp:TextBox>
ID="RequiredFieldValidator1" runat="server" ErrorMessage="Name Required" ControlToValidate="txtNewEmpName" ValidationGroup="v2"></asp:RequiredFieldValidator></td>


<asp:TemplateField HeaderText="Email">
<asp:Label ID="lblEmpEmail" runat="server" Text='<%#Eval("EmpEmail")%>'></asp:Label>
<asp:TextBox ID="txtNewEmpEmail" runat="server" Width="50px" Text='<%#Eval("EmpEmail") %>'></asp:TextBox>
ID="RequiredFieldValidator2" runat="server" ErrorMessage="Email Required" ControlToValidate="txtNewEmpEmail" ValidationGroup="v2"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid Mail Id" ControlToValidate="txtNewEmpEmail" ValidationExpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$" ValidationGroup="v2"></asp:RegularExpressionValidator>

<asp:Label ID="Label11" runat="server" Text="Total"></asp:Label>

While Editing the Rows ..(Alignment is not proper) reply Soon.

Post Your Reply Post New Question

 Viewer's Reply
EditItemTemplate Alignment
Answered By Moderator1 on 12/30/2011 5:49:44 AM

You can use ValidatorSummary control to display the Validation message in a properly aligned format outside the GridView control or by Message box alert. Otherwise you need to place a html table inside the EditItemTemplate section.
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks - Free 158 Page Preview
Integrating Silverlight 4 with SharePoint 2010 - Free 42 Page Sample Chapter
Backup and Recovery Best Practices for Microsoft SQL Server 2005