10.02.2014 Views

Beginning Ajax With ASP.NET (2006).pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 11<br />

3. The validationErrorLabel is set up with a targetElement and the associatedControl.<br />

Figure 11-5 shows the output of the preceding required field validator.<br />

Figure 11-5<br />

Try It Out<br />

Adding Datatype and Range Validation Support<br />

The next step in this example adds datatype and range validation support. By making the changes that<br />

follow to the xml-script section, the validation is added. In this example, the tag contains<br />

a tag. <strong>With</strong>in the tag, there are several validators that are set up. The first<br />

validator is the requiredFieldValdiator. The requiredFieldValidator requires that a value be<br />

entered for that field. The second validator is the typeValidator. The typeValidator sets the type<br />

that must be entered. In this example, the Number type must be entered. The third validator in this<br />

example is the rangeValidator. In this example, if a number outside of the range from 10 to 20 is<br />

entered, a message is presented to the user regarding the number being out of the specified range.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

302

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!