Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 22, 2013 07:45 PM by ddegil
Dec 19, 2007 08:18 PM|LINK
I want the Validation controls to display "block" rather than "inline". I have added the following lines to the Page_Load event:
While this works for the Label control and the inline is changed to block it does not seem to work for the validation control.
Dec 19, 2007 08:36 PM|LINK
Dec 19, 2007 08:38 PM|LINK
Dec 20, 2007 09:06 PM|LINK
First Name is required.
Last Name is required.
Dec 20, 2007 09:46 PM|LINK
I would enclose the validator in a div that is inline.
Feb 22, 2013 07:45 PM|LINK
<asp:RequiredFieldValidator runat="server" ID="rfvRequired" ErrorMessage="This is required.<br/>This is line 2" ControlToValidate="tbRequired" ValidationGroup="CommonAttributesValidationGroup" SetFocusOnError="True" CssClass="valerror" Display="Dynamic"></asp:RequiredFieldValidator>
To make the above validator to display as a block with a yellow background and a border simply add this to your style sheet (assumes the validator has the class of "valerror" as above. if not make sure you name them the same)
border: 1px solid #cccccc;
stock affecting the span. Instant block display.
I have tested this on IE10, FF and Chrome and it is working on them at my office and home. Once you make the style sheet as you want it to dislpay, you only have to make sure all the validators use the same CssClass.
Hope that help you out.