I have applied some validation with data annotations but somehow I am missing something in the code.
public class Person
{
public people SinglePerson { get; set; }
public IEnumerable<SelectListItem> ColorNames { get; set; }
public IEnumerable<SelectListItem> WebCustomer { get; set; }
public IEnumerable<SelectListItem> PreviouslyOredered { get; set; }
}
and here is my cs class
[MetadataType(typeof(peopleMetaData))]
public partial class people
{
}
public class peopleMetaData
{
[Required(ErrorMessage = "Please enter a name")]
[StringLength(50, MinimumLength = 2)]
public string firstName { get; set; }
}
The People class has a firstName property that I want to do some validation to.
What am I missing?