I want to validate some text boxes in my ASP.NET page using ASP required field validation. And I want to display that error message in top of the page.
<table>
<tr><td colspan='2'><b> User Input</b><br/></td></tr>
<tr><td colspan='2'>
<%--input validations--%>
<asp:RegularExpressionValidator ID="regexpName1" runat="server"
ErrorMessage="This expression does not validate."
ControlToValidate="TextBox_adTitle"
ValidationExpression="^[a-zA-Z'.\s]{1,40}$" />
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="TextBox_1" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<br />
</td>
</tr>
<tr><td>
<asp:Label ID="Label_name" runat="server" Text="Seller Name * "></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox_1" runat="server" ReadOnly="True" ></asp:TextBox>
</td>
</tr>
...
This is working fine. However, the first table row is keeping its space even error messages are not displaying on it. This will cause the UI to look bad on the page since unnecessary space is there when the page loads.
How can I hide the space of the first row (validation's error messages row) while the page is loading and when there is no validation error?