I'm having issues with asp.net field validators taking up space on my page. I searched around and the documentation says use Display = "Dynamic" so that the validators do not take up space. However, when I use this, error messages are always displayed.
What am I doing wrong?
I just want the error messages to appear when the user either clicks the Save button or loses focus on the text box. And I do not want the validators to take their place.
<p>Please enter a new email:</p> <asp:TextBox runat="server" MaxLength="255" ID="TextBoxEmail" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGgroup="Email" ErrorMessage="Please enter an email" ControlToValidate="TextBoxEmail" runat="server"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator2" ValidationGroup="Email" ControlToValidate="TextBoxEmail" ErrorMessage="Please enter valid email" runat="server" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" /> <p>Please re-enter your email:</p> <asp:TextBox runat="server" ID="TextBoxEmail2" /> <asp:LinkButton ValidationGroup="Email" runat="server" Text="Save" OnClick="linkbuttonSave_Click" />
source share