try to use Required Field Validator it validates both client side and server side and also ignore whitespaces during validation.I have some code that checks and makes sure that when the users enters in the field an integer from 1 - 10 has to be input.As shown here: Self-Validating Text Box But it does not show how to implement client-side validation. I like the first approach but don't know how to implement client-side validation. An approach that sounds more reasonable to me is to have your Text Box controls as they are on your page/usercontrol and to associate the validators from your code dynamically at runtime.2: Create custom control that derives from Text Box and add built-in validators I need. Say in your That's just a stupid example, just to explain the context.
Now I just drag out one, set the properties, and away we go.Every validation attempt means a round trip to the server.Ideally the control would send some Java Script to the client when the page is initialized.Let’s do those in order: Controlling how the error message is rendered: If you have used the Validators at all you should be familiar with the Display property.It can be set to three values: Static, Dynamic, and None where static always shows the error message, dynamic shows it when there is an error, and none only shows the message in the validation summary.