I l @ ve RuBoard |
RequiredFieldValidator ControlThe simplest of the validation controls is the RequiredFieldValidator control. This control, which you saw in our first example, simply checks to ensure that a value has been entered for a particular form control. If the required field is missing, this control will display its text and set the page's IsValid property to false. The control's Text should prompt the user that she needs to fill in a value for the associated control. The RequiredFieldValidator control inherits all the BaseValidator's properties described in Table 8.1, and also exposes its own property described in Table 8.3. Table 8.3. RequiredFieldValidator Class Additional Properties
Note that if the InitialValue property is set, the RequiredFieldValidator will not be triggered by an empty (null) value in the ControlToValidate control. Basically, this validator simply compares InitialValue with the validated control's value, and if the two are the same, the validator concludes that the control is invalid. Because we have already used this validator in an example, we will jump ahead to the next validation control before showing another example. The other validation controls are much more interesting than the RequiredFieldValidator , and we will see that by using these validators in concert, we are able to easily perform complex validation tasks that would have been very difficult, or at least tedious and time-consuming , using Classic ASP. |
I l @ ve RuBoard |