Thursday, February 15, 2007

Validation Tips

when you have a textbox and we enable TextMode Property = multiline, then MaxLength property does not work.
In order to have this feature, we have to either write a Regular expression or a custom control. I googled to find a regular expression that will do the task:

To limit characters(can have any characters) : ^\s*(\w\s*){1,250}\s*$
To limit only positive integers: \b\d+\b
To limit only alphabets: \b[A-ZA-z]+\b

Could come handy when u need it ..

http://regexlib.com/ is a good site for most of the regular expressions you will use.

Happy Coding :)

No comments: