2011-09-20 46 views
0
[Display(Name = "Mobile")] 
public string Mobile { get; set; } 

在上面的代码中,我想包括像...实体框架代码优先可选错误消息

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

但是,我不想做出所需要的领域。就在用户没有输入任何内容时,他们会收到一条消息。这可能吗?

感谢

+0

你可以检查conditin idf emailid == null然后如果你使用Windows窗体Messagebox.show(“你的消息”),否则继续你的编码 – 62071072SP

回答

0

你必须写下自己的UI控件来支持这种类型的暗示。它与验证的常用数据注释无关,因为您无法使用Required