The Validation Helper
ASP.NET Web Pages includes a helper — the Validation helper — that you can use to make sure that users enter data that meets your requirements. The Validation helper is one of the helpers that's built in to ASP.NET Web Pages, so you don't have to install it as a package by using NuGet, the way you installed the Gravatar helper in an earlier tutorial.
To validate the user's input, you'll do the following:
Use code to specify that you want to require values in the text boxes on the page.
Put a test into the code so that the movie information is added to the database only if everything validates properly.
Add code into the markup to display error messages.
In the code block in the AddMovie page, right up at the top before the variable declarations, add the following code: