157
asP.net
As shown in Listing 6.10 (Validation.aspx), no VB.NET program is
needed in this example. e ASP.NET program contains three validation controls:
RequiredFieldValidator (line 6) for validating whether the required fields are
filled, CompareValidator (line 18) for validating the data type of the input, and
RangeValidator (line 22) for validating the range of the data. Each validation
control must have required attributes including id, ControlToValidate, and
ErrorMessage. Some attributes, such as Operator and Type, are only required
for some validation controls.
You might remember that JavaScript is commonly used to validate a user’s input
on the client side. Compared with JavaScript, ASP.NET validation controls are slow
since they a