I am having some trouble with custom arguments in a complex type. When it runs on the client side instead of the argument being inserted correctly I get "ID Number is required for true" instead of "ID Number is required for Chris". If it is validation that occurs on the server side it works correctly. I assume that the model is not bound correctly for some reason. Any idea what I am doing wrong?
Here is an stripped down example of what I am doing:
Here is an stripped down example of what I am doing:
[Validator(typeof(ApplicationValidator))]
public class ApplicationViewModel
{
public int UserID { get; set; }
public List<IDViewModel> IDInfo { get; set; }
}
[Validator(typeof(IDValidator))]
public class IDViewModel
{
public string FirstName { get; set; }
public string LastName { get; set;}
public string IDNumber { get; set; }
public DateTime IssueDate { get; set; }
}
public class IDValidator : AbstractValidator<IDViewModel>
{
public IDValidator()
{
RuleFor(m => m.IDNumber)
.NotEmpty().WithMessage("ID Number is required for {0}.", m => m.FirstName);
}
}