I ask a similar question here . This is my model:
[DisplayName("National Code")] [Required(ErrorMessage = "Required")] [RegularExpression(CustomRegex.SSNRX, ErrorMessage = CustomRegex.SSNErMsg)] [Remote("DBValidateSSN", "CustomerProfile", "Members", ErrorMessage = "Repeated.")] public string SSN { get; set; }
Therefore, I use the generic class as a model, and my view looks like this:
@Html.EditorFor(model => model.MainModel.SSN) @Html.ValidationMessageFor(model => model.MainModel.SSN)
And confirm the action:
public JsonResult DBValidateSSN([Bind(Prefix = "MainModel")] string SSN) {
But the SSN parameter in action is always zero, where is my error? what is the problem, I also check Ajax Request Params in FireBug and used name MainModel.SSN
, what is your suggestion?
Saeid source share