Prev Question
Next Question

You need to enable client-side validation for an ASP.NET MVC application.
Which three actions should you perform? Each correct answer presents part of the solution.

Attach a custom validation attribute to the model properties that the view uses.

Reference the jquery, jquery.validate and jquery.validate.unobtrusive script files in the view.

Open the web.config file at the project root, and set the values of the ClientValidationEnabled and
UnobtrusiveJavaScriptEnabled keys to True.

For each form element, use the Validator.element() method to validate each item.

Add data annotations to the model properties that the view uses.

B: The validation can be implemented using jQuery and jQuery validation plug-in (jquery.validate.min.js and
jquery.validate.unobtrusive.min.js).C: When you are developing an MVC application in Visual Studio 2012 then the client-side becomes enabled by
default, but you can easily enable or disable the writing of the following app settingcode snippet in the
web.config file.
<add key=”ClientValidationEnabled” value=”true” />
<add key=”UnobtrusiveJavaScriptEnabled” value=”true” />
E: The jQuery validation plug-in takes advantage of the Data Annotation attributes defined in the model, which
means that you need to do very little to start using it.
ASP.NET MVC Client Side Validation

Prev Question
Next Question

Leave a Reply

Your email address will not be published. Required fields are marked *