2011-09-20 49 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