ASP.NET Validator Whitespace Removal?

liunx

Guest
Is it possible to use ASP.NET's built-in validator web controls in a form without having all of that whitespace after the textbox web control?

In my form, the <EditItemTemplate> and <FooterTemplate> each have a set of validator controls, and this causes extra space under the textbox web control until one or more of the validators are activated. Here's an example:

<EditItemTemplate>
<asp:Textbox runat="server" Columns="20" id="txtcontactID_edit" Width="20px" Text='<%# DataBinder.Eval(Container.DataItem,"contactID") %>' />
<asp:RequiredFieldValidator id="valRFcontactID_edit" runat="server" Text="REQUIRED: 1-3 chars" ControlToValidate="txtcontactID_edit" />
<asp:RegularExpressionValidator id="valREcontactID_edit" runat="server" ControlToValidate="txtcontactID_edit" Text="REQUIRED: 1-3 chars" ValidationExpression="\d{1,3}" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox id="txtcontactID_add" runat="server" Columns="2" />
<asp:RequiredFieldValidator id="valRFcontactID_add" runat="server" Text="REQUIRED: 1-3 chars" ControlToValidate="txtcontactID_add" />
<asp:RegularExpressionValidator id="valREcontactID_add" runat="server" ControlToValidate="txtcontactID_add" Text="REQUIRED: 1-3 chars" ValidationExpression="\d{1,3}" />
</FooterTemplate>

...causes 2 line-breaks after the textbox web control. Is there a way to not display this whitespace when the validators are "inactive"? Thanks for any help.I answered my own question:

Change Display="Static" to Display="Dynamic"

...and it worked. Good job myself:)
 
Back
Top