You need to make sure the data a user enters matches an entry in a database.
CustomValidator to the
.aspx file. Then add an event handler to the
code-behind for the
whose purpose is to validate the user entries against the database.
CustomValidator control that validates the
entries against the database during server-side validation.
Add a Login (or equivalently named) button.
In the code-behind class for the page, use the .NET language of your choice to:
Add an event handler for the
whose purpose is to provide the server-side validation of the
user’s entries against the database.
Add code to the event handler for the Login button’s
click event to check the
Page.IsValid property and
verify that all validation was successful (see Recipe 2.1 for details).
Figure 2-11 shows a typical form with normal output
prior to data entry. Figure 2-12 shows the form with
a validation error message. Example 2-10
through Example 2-12 show the
.aspx and code-behind files for our application
that implements the solution.
Figure 2-11. Form with database validation output—normal
Figure 2-12. Form with database validation output—with ...