Reputation: 728
In VB.NET , I am trying to validate a
<asp:textbox id="name" runat=server> </asp:textbox>
textbox value which should not exceed more than 200 characters and the textbox takes only string.
Which validator will be a good option ? i want to use custom validator, will it work with string values?
Upvotes: 1
Views: 3716
Reputation: 216273
You can avoid the use of custom validator altogether.
If you only need to force the max length of a text box field you have this at your disposal
<asp:TextBox MaxLength="200" id="name" runat=server> </asp:TextBox>
Upvotes: 0
Reputation: 27659
<asp:RegularExpressionValidator ID="regexTextBox1"
ControlToValidate="YourTextBoxID" runat="server"
ValidationExpression="^[\s\S]{0,200}$" Text="200 characters max" />
Upvotes: 1