Requiring Data Entry
You'll often need to ensure that users enter a value into a control on a page. To make this easy, ASP.NET provides its RequiredFieldValidator control. On the sample page, EmpMaint.aspx, users must supply values for the First Name, Last Name, Birth Date, and Hire Date fields. Leaving any of these blank isn't allowed, and you need some way to indicate this to users. Figure 8.1 shows the sample form, after a user has attempted to submit the page by clicking Save without filling in any information. This page displays individual indicators of the fields that must be supplied.
Figure 8.1. The RequiredFieldValidator control makes it easier to avoid data fields left empty.
TIP
If you watch carefully as you test this page, you'll ...
Get ASP.NET Developer's JumpStart now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.