Validating length of textbox
The CSS rules that end in to both have the same fixed size.That way, the display area for the field is static and won't change the page flow if an error message is displayed.Therefore, you also have to make sure that the values that users enter can be correctly converted to the appropriate data types.You might also have certain restrictions on the values.For example, here's what the page looks like if you forget to enter a course name, if you enter an, and if you enter an invalid date: By default, user input is validated after users submit the page — that is, the validation is performed in server code.A disadvantage of this approach is that users don't know that they've made an error until after they submit the page.Even if users correctly enter an integer, for example, you might need to make sure that the value falls within a certain range.Note Important Validating user input is also important for security.
In this example I use simple class named Input Box with static method Show (to be similar to Message Box. It has overloaded static method Show which takes following paramaters: a dialog title, a prompt text, a default value and optionally a validation delegate.
The length method counts how many characters are in a string and returns the number. Choose Visual Basic in installed templates, select ASP.
This is useful for arrays or when validating a word has to be at least a minimum size.
If a user enters a non-integer value, the error is reported as soon as the user leaves the entry field.
Users get immediate feedback, which is convenient for them.