I am using DataAnnotations for form field validation. So for example I have a contact model with the below property:
[Required(ErrorMessage = "Please enter your first name.")]
[StringLength(100)]
public string FirstName { get; set; }
But instead of the error appearing at the side of each control, I need them to appear in a list above the form itself. What is the best way to do that?
Thanks.
See:
Put that on top or whereever in your form and it’ll summarize all your validation errors.