User Input Validation
Pages written using the Razor syntax can take advantage of both client-side and server-side validation. This validation is actually provided by the jQuery.validate.js plug-in (script files) included with the default project template. Recall that the model already includes field-level validation rules using data annotations. These rules will be applied to the client code by ASP.NET when binding the model fields to the view. Of course, these same rules will process on the server, too.
The HTML helper methods and TagHelpers can be used to define validation; they require the jquery.validate plug-in to be added to the view. Recall that the shared _Layout.cshmtl page defined a section called scripts for adding script files to ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access