ASP.NET validators alignment issue

Posted by Mahesh on Stack Overflow See other posts from Stack Overflow or by Mahesh
Published on 2010-05-11T13:59:36Z Indexed on 2010/05/11 14:04 UTC
Read the original article Hit count: 376

Filed under:
|

Hi,

I am developing contactus webpage which have a input field called Email. It is validated against a required field validator and regular expression validator with appropriate messages.

Required: Enter Email Regular Expression: Invalid Email

I am setting these two as given below:

<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                                    <font color="#FF0000">*</font>
                                    <asp:RequiredFieldValidator ID="rfvemail" CssClass="error_text" ControlToValidate="txtEmail"
                                        runat="server" ErrorMessage="Enter email address."></asp:RequiredFieldValidator>
                                         <asp:RegularExpressionValidator ID="revemail" runat="server" ControlToValidate="txtEmail"
                                            ErrorMessage="Invalid Email" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>

My problem is both Enter Email and Invalid Email is occupying its own space. For Ex: If I leave email as empty space and press submit, Enter Email is displaying right next to it. If I enter invalid email(xxx), Enter Email is off but taking the space, Invalid Email message is displayed after these space taken by 'Enter Email' before.

Is there any way to remove this space??

Mahesh

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about validators