【发布时间】:2014-05-09 13:14:18
【问题描述】:
我正在验证 Gridview 中的文本框。错误消息在它应该显示的时候显示,但消息的第一个单词显示在文本框旁边,其余的显示在它下面。如何确保整个消息都在文本框下方。
这是 .aspx 代码:
<asp:GridView ID="MappingGridView" runat="server" AllowSorting="True" AutoGenerateColumns="False" Caption="Enrollment Mapping Information" CaptionAlign="Top"
CssClass="grid" HorizontalAlign="Left" ShowFooter="True" AllowPaging="True" PageSize="4" ShowHeaderWhenEmpty="true" OnPageIndexChanging="MappingGridView_PageIndexChanging"
OnRowDataBound="MappingGridView_RowDataBound" OnRowCommand="MappingGridView_RowCommand">
<Columns>
<asp:TemplateField HeaderText="MappingID" SortExpression="mgvMappingID">
<ItemTemplate>
<asp:Label ID="mgvLblMappingID" runat="server" Text='<%# Bind("EnrollmentMappingID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="CECityActivityID" SortExpression="mgvCECityActivityID">
<EditItemTemplate>
<asp:TextBox ID="mgvEditCECityActivityID" runat="server" Text='<%# Bind("CECityActivityID") %>'></asp:TextBox>
<asp:RegularExpressionValidator ID="RegExpValEditCECityID" ControlToValidate="mgvEditCECityActivityID" runat="server"
ErrorMessage="Enter 0-9, A-F, and hyphens. Maximum length is 50." ValidationGroup="MappingGrid" ValidationExpression="^[0-9A-Fa-f-]{0,50}$"
Display="Dynamic" CssClass="message-error">
</asp:RegularExpressionValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="mgvLblCECityActivityID" runat="server" Text='<%# Bind("CECityActivityID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="mgvInsertCECityActivityID" runat="server" Width="90%"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegExpValCECityID" ControlToValidate="mgvInsertCECityActivityID" runat="server"
ErrorMessage="Enter only 0-9, A-F, and hyphens; maximum length is 50." ValidationGroup="MappingGrid" ValidationExpression="^[0-9A-Fa-f-]{0,50}$"
Display="Dynamic" CssClass="message-error">
</asp:RegularExpressionValidator>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
这是展示:
如何让文本完全显示在文本框下方的行上?
谢谢, 格洛丽亚
【问题讨论】:
标签: asp.net gridview validation