我有一个双可变错误的错误消息:所以我说数据诠释 - 对数字
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