When attempting to create a lengthy RegEx ErrorMessage via server controls, I though it would be a nice add a background color and boarder to give the message some "flair".
When I tried attaching a CssClassto the server control with a border and color, the border ran over across two lines like below:
______________________________________
| |
| --------------------------- |
| | 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>
Also, when it hides, the boarder is visible (just not the contents)
I have tried placing the control in a div with run at server. The issue with that is when you hide the div, the regex validation stops. Any ideas on how to approach this?