I have Remote validation for Postal code field and country Id is passed to it as additional field. following is the code:
public JsonResult IsValidPostalCodeForCountry(string CompanyPostalCode, string CompanyCountryID)
{
//My validation code
return Json(true, JsonRequestBehavior.AllowGet);
}
Model:
[PostalCodeRemoteValidation("IsValidPostalCodeForCountry", "Common", "", AdditionalFields = "CompanyCountryID")]
[Required(ErrorMessageResourceName = "valPostalcodeRqrd")]
public string CompanyPostalCode { get; set; }
[Required(ErrorMessageResourceName = "valCountryRqrd")]
public int CompanyCountryID { get; set; }
Can the names is action parameter and names in model property be different?
Why I want this?
to call same remote validation method from different models where name of property can be different.