Introduction
For some of our web applications we must validate the uniqueness of a field, for example when we create a user for the application then the user Id must be unique in order to provide login capability for the system. To do this we need to write code to make a remote server call to validate the field.
ASP.NET MVC provides a mechanism that can make a remote server call to validate the field without posting the entire form to the server. The "Remote" validation attribute is useful for that. This attribute is useful when we have a field that cannot be validated on the client side so we must validate it on to the server side.
Remote Attribute
The Remote attribute class uses the jQuery validation plug-in remote validator. With remote attribute, we need to pass a route name (to validate the text on the server side) or pass an action and controller name. This attribute enables a client-side validation and makes a call to the server when the actual validation is done.
For example, I want to create a customer registration form and it has a user id that must be unique within the database. I want to validate this user id using a remote attribute. The Following is the procedure to use a remote attribute in this case.
Step 1
Create a model for the customer and apply the report validation for the column user id.
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.



Safvan AKPosted Aug 12, 2020, 1:20 AM
Can I pass Encrypted value instead of plain text ??
Jignesh TrivediPosted Apr 27, 2015, 12:19 AM
Thank you all for reading and commenting....
Ayush KumarPosted Apr 19, 2015, 11:33 PM
Thanks
Sibeesh VenuPosted Apr 15, 2015, 8:37 AM
Good one.
Manish Kumar ChoudharyPosted Apr 15, 2015, 4:55 AM
Good one.
NitinPosted Apr 15, 2015, 2:54 AM
good one
Santhakumar MunuswamyPosted Apr 14, 2015, 10:56 PM
Thanks for sharing