posted 2/4/2009 by Sumit Arora
Sometimes there can be a situation where we want to validate maximum length of a
textbox content.This can be done in many ways.
One way of doing it is through Regular Expression:
<asp:TextBox ID ="txtBox" runat="server"/>
Now,take the Regular expression validation control
<asp:RegularExpressionValidator ID="validateTextBox" runat="server"
Display="dynamic" ControlToValidate="txtBox" ValiadtionExpression="^([\S\s]{0,50})$">
Please,enter text less than 50 characters
</asp:RegularExpressionValidator>
Now,user can enter only 50 characters in the textbox.
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18