Click here to Skip to main content
14,971,296 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
An aspx page contains a couple of textBoxes. For a textbox, there are 3 Validators, which shows an extra spacing between this textbox and another one below it. If there are only 2 validators, the extra space is gone. I tried the ccs but not effective. How can the extra space be eliminated? Thanks.

ASP.NET
        <tr>
            <td style="text-align: left">
                <asp:Label ID="lblPasswordNew" runat="server" CssClass="lbl" Font-Bold="true" 
                    Font-Size="Small" Text="New Password:">
                </asp:Label>
                    </td>
            <td class="style1">
                <asp:TextBox ID="txtPasswordNew" runat="server" AutoPostBack="false" 
                    ClientID="txtPasswordNew" Font-Size="Small" MaxLength="45" 
                    onKeyDown="keyPress();" onKeyPress="keyPress();" TabIndex="3" 
                    TextMode="Password" Width="150px">
            </asp:TextBox>
                <asp:Label ID="txtPasswordNew_V" runat="server" CssClass="lbl_req" Text="*" 
                    Width="5px"></asp:Label>
            </td>
        </tr>
        <tr>
            <td colspan="3" 
                style="text-align: center;padding-removed.12em;padding-removed.12em;">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtPasswordNew" CssClass="lbl_error" Display="Dynamic" 
                    ErrorMessage="Password cannot be empty.">
            </asp:RequiredFieldValidator>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                    ControlToValidate="txtPasswordNew" CssClass="lbl_error" Display="Dynamic" 
                    ErrorMessage="Password must contain minimum 8 characters at least 1 upper case alphabet, 1 lower case alphabet, 1 number and 1 special character (!,@,#,$) and is case sensitive." 
                    ValidationExpression="^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!#])[A-Za-z\d$@$!#]{8,45}">
            </asp:RegularExpressionValidator>
            <asp:CompareValidator ID="CompareValidator2" runat="server" 
                    ControlToCompare="txtPasswordOld" ControlToValidate="txtPasswordNew" 
                    CssClass="lbl_error" 
                    ErrorMessage="New password must be different from the old one." 
                    Operator="NotEqual" Type="String">
            </asp:CompareValidator>
            </td>
        </tr>
// --------- css below --------
        .lbl_error  {
            font-family: helvetica, arial, sans-serif;
            font-size:smaller;
            text-align:center;
            color:Red;
        }
Posted

1 solution

It involves two CSS things: padding and margins. Please see:
http://www.w3.org/TR/CSS2/box.html[^],
https://developer.mozilla.org/en-US/docs/Web/CSS/box_model[^].

—SA
   
Comments
s yu 22-Apr-15 13:29pm
   
SA: Thanks for your response. I checked and played my css items: padding and margins, but not working.
Sergey Alexandrovich Kryukov 22-Apr-15 15:27pm
   
It does work. You could have missed some properties on some elements.
I was not a "response", it was the answer to your question.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900