简体   繁体   中英

Required field validator text positioning

I have problem getting my text from the validation under my textbox. It show up behind my textbox, just like in picture.

textboxvalidationmissplace

In my code for the type of assignment and assignment start textbox i have a css-class setting saying that display = block. That put the validation text under the textbox. If i put that on this element my second textbox end up under the first one (for example, the big empty textbox after the textbox saying AC- end up under the textbox saying AC-). I tried all different solutions but maybe I'm staring myself blind on the problem. I will pust my current code and i hope anyone out there can help me fix this problem.

first my aspx...

    <div class="floatLeftPaddTop15PaddLeft40">
        <asp:Label id="costCodesLabel2" runat="server" >Cost code 2:</asp:Label><br />
        <asp:TextBox id="costCodeTextBox2Prefix" runat="server" CssClass="textBoxPrefix" Visible="false" ></asp:TextBox>
        <div class="costCodeDiv" >
            <asp:TextBox id="costCodeTextBox2" runat="server" CssClass="textBoxSuffix" ></asp:TextBox>
            <asp:RequiredFieldValidator ID="costCodeValidator2" runat="server" ControlToValidate="costCodeTextBox2" ErrorMessage="Cost code is required."
                ForeColor="Red"  Display="Dynamic" Enabled="false" />
        </div>    
    </div>

then my css...

.textBoxSuffix {
    width: 120px;
    height: 22px;
    border: 1px solid #999; 
}.

.textBoxPrefix {
   width: 35px;
   height: 22px;
   border: 1px solid #999;
}

或者您可以使用html表构建页面...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM