Displaying Validation Errors
The last step is to display any error messages. You can display individual messages for each validation error, or you can display a summary, or both. For this tutorial, you'll do both so that you can see how it works.
Next to each element that you're validating, call the Html.ValidationMessage method and pass it the name of the element you're validating. You put the Html.ValidationMessage method right where you want the error message to appear. When the page runs, the Html.ValidationMessage method renders a element where the validation error will go. (If there's no error, the element is rendered, but there's no text in it.)
Change the markup in the page so that it includes an Html.ValidationMessage method for each of the three elements on the page, like this example: