开发者

Entity Framework Code First Optional Error Message

[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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜