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.
精彩评论