asp.net mvc - Data Annotation for MVC 5.0 is not working -
public class dropdownlistviewmodel { [required] public string selectedid { get; set; } public ienumerable<selectlistitem> items { get; set; } } public class account { public dropdownlistviewmodel country { get; set; } }
how error message related country field. shows generic message saying 'selectedid required', want message related country field.
use errormessage
have own custom error message
[required(errormessage = "custom message")] public string selectedid { get; set; }
Comments
Post a Comment