RequiredFieldValidator ensures the user
provides a value for your control, or in the case of drop drop-down lists, that the
user picks something other than the default value.
To get started, create a new web site called
RequiredFieldValidator. In this section, you're going create the
shipping selection web page shown in Design view in Figure 5-1. This is a pretty standard
shipping form, as you can see on any number of web sites. You can imagine how you'd
incorporate such a page into your own site.
Figure 5-1. This shipping selection page incorporates RequiredFieldValidator controls to ensure that users make selections in each field.
When the user clicks the Submit button, the page is validated to ensure that each field has been modified. If not, the offending field is marked with an error message in red, as shown in Figure 5-2.
You'll use a 3-column, 5-row HTML table to create the page layout, into which you'll place the necessary controls. Using what you've learned from the previous chapters, you can create the table fairly easily, either directly in Source view, or using the Table Wizard, so we won't ...