MVC Remote Validation

ASP.NET MVC 3 supports the new RemoteAttribute class that enables you to take advantage of the jQuery Validation plug-in's remote validator support. This enables the client-side validation library to automatically call a custom method that you define on the server in order to perform validation logic that can only be done server-side.

Step1: The appSettings element contains the following keys to enable client validation and enable unobtrusive JavaScript validation.

Step2: Define the remote attribute to the prop in model

Step3: Define the Remote method making the return type as Json , as the communication will be done in ajax mode.

Step4: Create a view , with strongly typed to the Model in which you defined the Prop. Select "Razor" in engine type. Select "Create" option in scaffold dropdown. A view will be created and you can test the functionality.

Happy Coding !
Click Here
Is it helpful for you? Kindly let me know your comments / Questions.

1 comment:

  1. very helpful, i wonder if I can integrate this with KendoUI Grid. hmm