开发者

Entity Framework Code First Optional Error Message

开发者 https://www.devze.com 2023-04-05 21:39 出处:网络
[Display(Name = \"Mobile\")] public string Mobile { get; set; } In the above code i want to include something like...
[Display(Name = "Mobile")]
public string Mobile { get; set; }

In the above code i want to include something like...

[Required(ErrorMessage="If you don't enter your email we cant send a text confirmation")]

However, i don't want to make th开发者_如何学Pythone field required. Just if a user doesn't enter anything they get a message saying this. Is this possible?

Thanks


You must write your own UI control to support this type of hint. It has nothing to do with common data annotations for validation and because of that you cannot use Required.

0

精彩评论

暂无评论...
验证码 换一张
取 消