Name defines the label of the property and Prompt will set a placeholder that disappears as soon as the user starts typing in the text box: Book insertion form with Display data annotation in .

NET Core MVC application " data-medium-file="https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-summary-in-form-of-net-core-mvc-application.png? w=300" data-large-file="https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-summary-in-form-of-net-core-mvc-application.png? w=550" src="https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-summary-in-form-of-net-core-mvc-application.png? w=630" alt="Data validation exception summary in form of .

NET Core MVC application" class="alignnone size-full wp-image-9255" srcset="https://dotnetcodr.files.wordpress.com/2017/02/550w, https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-summary-in-form-of-net-core-mvc-application.png?

Data annotation in itself will not prevent the controller from executing its POST Create action method. If there’s a validation error then the model state will know about it but the exceptions it has in its list won’t be applied automatically in our controller code.

The POST Create method will need to be extended as follows: If the model state is valid then we enter a book. MVC will figure out that we mean the current book insertion view presented by GET Create.

There’s also another way to present the data validation messages.

The validation summary helper method can be placed within the form: Data validation exception summary in form of .

That’s how the user will see the data validation exceptions: Data validation exception messages in book insertion form in .

NET Core web application " data-medium-file="https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-messages-in-book-insertion-form-in-net-core-web-application.png? w=300" data-large-file="https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-messages-in-book-insertion-form-in-net-core-web-application.png? w=569" src="https://dotnetcodr.files.wordpress.com/2017/02/data-validation-exception-messages-in-book-insertion-form-in-net-core-web-application.png? w=630" alt="Data validation exception messages in book insertion form in .

You can learn about block registration, and the available options, in the block registration documentation.