开发者

using a validator next to a text box

开发者 https://www.devze.com 2022-12-14 10:05 出处:网络
I placed a validator control right next to a text box to check its validaton. But when I click Save and if the text box field is empty, the validation star appears on the next line. How do I make it a

I placed a validator control right next to a text box to check its validaton. But when I click Save and if the text box field is empty, the validation star appears on the next line. How do I make it appear right next to the text box?

        <asp:UpdatePanel ID="upFirstName" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Literal ID="litFirstName" runat="server" />
     开发者_Python百科           <asp:TextBox ID="txtFirstName" runat="server" CssClass="text span-4" />
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="txtFirstName" Display="Dynamic" 
                    ErrorMessage="First name is required." ValidationGroup="AllValidators" 
                    ForeColor="#186E94">*</asp:RequiredFieldValidator>
            </ContentTemplate>
        </asp:UpdatePanel>


Set the Display property of the Validator to "Dynamic" :-)

http://www.dotnetcurry.com/ShowArticle.aspx?ID=121

EDIT:

Temporarily remove the CSS and see what happens.

0

精彩评论

暂无评论...
验证码 换一张
取 消