view more software Tips and Tricks
Updated: 09/18/2013 11:09 AM
Author: Shiju Mathews
Complete the server side custom ValidationAttribute, Refer How to create a custom ValidationAttribute in MVC 3?
Open files TimeCard.cs in Model folder.
Add a reference to “System.Web.Mvc” namespace.
Add Remote Validation Attribute to Username Property.
Where TimeSheet is the Controller and CheckUsername is the JsonResult(similer to ActionResult)
Open TimeSheetController and add the method CheckUsername
Run the project in Visual studio and navigate to the view where the model is using. In this example any username other that Shiju will give error “Invalid Username”.