问题描述
我有以下的code在我的模型类:
I have the following code in my Model class:
[Range(1, 100)]
public decimal Price { get; set; }
最近jquery.validate的升级(我假设)到1.11.0之后,我越来越即使我输入有效的值时发生错误。如果我在web.config中关闭客户端验证 - 工作正常。所有其他属性(StringLength,必需)做工精细。生成的HTML如下(增加了清晰度换行):
After recent upgrade (I assume) of jquery.validate to 1.11.0, I am getting an error even if I enter valid value. If I turn off client validation in web.config - works fine. All other attributes (StringLength, Required) work fine. Generated HTML is the following (line breaks added for clarity):
<input class="text-box single-line" data-val="true"
data-val-number="The field Price must be a number."
data-val-range="The field Price must be between 1 and 100."
data-val-range-max="100" data-val-range-min="1"
data-val-required="The Price field is required." id="Price" name="Price"
type="text" value="" />
我是pretty确保它之前......工作可没想到的任何东西,但在jquery.validate的bug。
I am pretty sure it worked before... Can't think of anything but the bug in jquery.validate.
推荐答案
微软发布一个更新microsoft.jQuery.Unobtrusive.Ajax和microsoft.jQuery.Unobtrusive.Validation(从版本2.0.20710.0到2.0。 30116.0'),修复两个 .live和验证问题
Microsoft issued an update to microsoft.jQuery.Unobtrusive.Ajax and to microsoft.jQuery.Unobtrusive.Validation (from version '2.0.20710.0' to '2.0.30116.0') that fixes both .live and validation problems
这篇关于在DataAnnotation范围属性客户端验证之旅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!