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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -