AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
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
Hi..
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">
<ItemTemplate>
<asp:Label ID="lblEmpName" runat="server" Text='<%#Eval("EmpName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtNewEmpName" Width="50px" runat="server" Text='<%#Eval("EmpName") %>'></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server" ErrorMessage="Name Required" ControlToValidate="txtNewEmpName" ValidationGroup="v2"></asp:RequiredFieldValidator></td>

</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Email">
<ItemTemplate>
<asp:Label ID="lblEmpEmail" runat="server" Text='<%#Eval("EmpEmail")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtNewEmpEmail" runat="server" Width="50px" Text='<%#Eval("EmpEmail") %>'></asp:TextBox>
<asp:RequiredFieldValidator
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>

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

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
Hi,

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
Sexy Web Design - Free 71 Page Preview!
Introduction to Web Applications Development