I am writing an online assessment form. On this form the user has to select a minimum of 3 and a maximum of 7 people who will provide an assessment on them. I have a form where the user adds the assessors and I display the list underneath this form. Once the user has finished adding assessors then click on the self assessment button to fill his/hers own self assessment.
What I want to do is to validate that indeed the number of assessors is in the right range before the user leaves the page.
The model is like this
public class AssessorsViewModel
{
List<Assessor> Assessors { get; set; }
}
public class Assessor
{
string Email { get; set; }
string Name { get; set; }
}
I have validation attributes for the Assessor class so everytime the user adds an assessor I can validate this, but I can't figure out how to validate the Count on the Assessors List.
I am using ASP.net MVC.
Thanks in advance