Validating integer datatype with regularexpressionvalidator
You can protect against empty fields with the Required Field Validator, and you can protect against wrong values like text with for instance a Regular Expression Validator, which we will show you how to use a bit later.If the clientside validation is not working, the invalid form will be catched by our piece of code in the Code Behind file, as shown with the Required Field Validator.
NETLearn AJAXLearn Silverlight Learn Visual Studio Learn ADO. NETLearn Web Services Learn Controls Learn Biz Talk Learn Share Point Learn Mobile Learn SQLLearn SQL Reporting Learn Windows Forms Learn XMLLearn Crystal Reports Learn Far Point Learn Dev Express Examples ASP.The control allows you to validate both clientside and serverside, where the serverside approach is probably the most powerful. Value, which is the string of the control being validated, for it's length.Of course, doing serverside validation requires a postback to validate, but in most cases, that's not really a problem. If it's exactly 8 characters long, we return true, otherwise we return false.In this example, we will simply check the length of the string in the Text Box. This is a very basic and that useful example, only made to show you how you may use the Custom Validator.
For instance, it would be possible to enter nothing, or enter a piece of text instead of a number.