Posted by: adnanrashid on: January 10, 2009
Unlike the normal TextBox, the MaxLength property doesnt work for MultiLine TextBox. Heres a small trick to solve the problem:
<asp:TextBox ID=”txtExample” runat=”server” TextMode=”MultiLine” />
<asp:RegularExpressionValidator ID=”revExample” runat=”server”
ControlToValidate=”txtExample” ValidationExpression=”[\s\S]{1,200}”
Display=”Dynamic” ErrorMessage=”Length cannot be greater than 200 characters” />
The above markup validates the revExample TextBox / textarea and limits the max characters to 200. By modifying the regular expressions, [...]