我有一個雙可變錯誤的錯誤消息:所以我說數據詮釋 - 對數字
public double Width { set; get; }
我要驗證的數量,並顯示一條錯誤消息:
[Range(0.0, Double.MaxValue, ErrorMessage = "Width must be a valid number")]
它的偉大工程,如果我輸入一個負數,但如果我將它留空或輸入字母 - 內部錯誤消息是
「輸入字符串格式不正確。」
我不是usign @ html.validationmessagefor,因爲我需要手動處理ModelState的ErrorMessage或error.exception.InnerException.message。
我該如何解決這個問題?
查看http://stackoverflow.com/questions/3451255/asp-net-mvc-int-property-bind-exception – LostInComputer 2013-04-07 12:07:40