restricting min no of characters in asp.net text box
steven wrote:how do we restrict min no of characters in asp.net text box control?
Just use a Regular Expression Validator.
Toggle the validator's Enabled property to true or false based on the DropDownList's SelectedValue property. You can do that through a simple subroutine / function.
How you define a "character" is the question.
If you mean letters and numbers only, your ValidationExpression for the control would be: \w{2,}
If you mean only letters, your expression would be: [a-zA-Z]{2,}
If you mean only numbers, your expression would be: [0-9]{2,}
If you mean anything except white space or control characters, your expression would be: \S{2,}