If you use an ASP Required Field Validator to validate RichTextBox content you may find that it validates even when there is no text displayed in the editor. This is due to HTML fomatting tags being used to validate even when there are no text elements within the tags. For example the following will validate fine with the Required Field Validator -
<p><font face="Trebuchet MS" color="darkblue" size="4"><font style="BACKGROUND-COLOR: lawngreen"></font></font> </p>
These tags will still be there even if the user removes all the text from the editor. To validate the actual content so that it does include text elements we can create an ASP Regular Expression Validator like the following –
<asp:regularexpressionvalidator id="RegularExpressionValidator1" runat="server"
ErrorMessage="Please input some content." ControlToValidate="RichTextBox1"
ValidationExpression=".*>\w+<.*"></asp:regularexpressionvalidator>
If a text element/content is input between the tags e.g Name5 then the validation succeeds. The HTML fragment above would fail however as there is a no text between the tags.
For the Developer's Guide to .NET Framework Regular Expressions.
Please see -http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcomregularexpressions.asp