Friday, January 6, 2012

How to make one field is optional (not required) in ASP.NET MVC data annotations for validation?


Make that field is nullable in model. Such as:

        [Display(Name = "ID")]

        public int? ID { get; set; }