While working on creating a lengthy RegEx error message using server controls, I had the idea to add some style by giving the message a background color and border.
However, when I tried to add a CSS class to the server control with a border and color, the border spanned across two lines like this:
______________________________________
| |
| --------------------------- |
| | My very long error message | <-- confined box where error
| ---------------------------- | messages and text-box for input
| ---------------------------- | resides
| that ran over two lines | |
| --------------------------- |
| |
| ^ |
| | The two line error |
| message |
|_____________________________________|
<asp:RegularExpressionValidator
ID="MyFirstRegex"
ControlToValidate="SomeControl"
runat="server">
Display="Dynamic"
CssClass="SomeClass"
ValidationGroup="MyGroup"
ErrorMessage="Silly User. <br\> You made a very, very, very, very, very dumb error"<br />"
ValidationExpression="regex code to validate"
</asp:RegularExpressionValidator>
<asp:RequiredFieldValidator
ID="ReqOne"
ValidationGroup="MyGroup"
ControlToValidate="SomeControl"
runat="server">
</asp:RequiredFieldValidator>
Furthermore, even when hidden, the border remains visible (just not the contents).
I attempted placing the control in a div with `run at server`. However, the issue with that is once you hide the div, the regex validation ceases to function. Do you have any suggestions on how to approach this?