Limiting the length of a multiline textbox

Limiting the length of an mulitline textbox control is easy. Add a RegularExpressionValidator, set the ControlToValidateProperty to the ID of the TextBox you wish to validate and set the ValidationExpression property to :


This tells the regex validator to limit the number of characters in the Textbox to 300.


^ Start of Line
[] Character class (list the characters you want to match)
\s White space characters including new line
\S Non-white space characters
{intMin,intMax} Intervals; The minimium number of matches you want to require and the max number of matches you want to allow

Posted via email from fenildesai's posterous