I have a case in my application where no two records should have the same Assessment name. To do so i am implementing this rule using the Remote validation attribute for both client and server side validation. As follow:-
[Remote("CheckAssessmentName", "Assessment")]
[Required]
public string AssessmentName { get; set; }
public JsonResult CheckAssessmentName(string AssessmentName)
{
var c = elearningrepository.checkname(AssessmentName).Count() == 0;
return Json(c, JsonRequestBehavior.AllowGet);
}
The problem is that the client side validation will be triggered each time the user insert or delete a character in the Assessment name field ,, so i am afraid that this will cause a performance issue assuming that i might have hundreds of assessment records, so should i use my current approach or there is a better way to do this?
Second question can i disable the client side validation for this specific Remote validation attribute for that i will only check the existence of the assessment name only on the server !!?
BR
No one can answer this for you without knowing your server stats, what else is running, network perf , query with or without indexes etc
Try it, just remember you have to check on the server side as well since remote validation does not automatically Validate again when you save your form meaning if JavaScript is off( or scripts havent loaded before they submit the form) then they can bypass the checks