且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

随着全球化ASP.NET MVC 3 RC 2客户端验证

更新时间:2023-02-25 14:13:06

不幸的是jQuery.validate.format和jQuery.Globalization.format功能之间的命名冲突。因此,你必须改变你的code使用非的jQuery插件全球化

Unfortunately there's a naming conflict between jQuery.validate.format and jQuery.Globalization.format functions. Therefore you'll have to change your code to use the non-jquery Globalization plugin.

我刚写了一篇博客文章在这里 >。

I just wrote a blog post about it here.

有关,你就应该是这样的:

For you it should look like this:

<script src="@Url.Content("~/Scripts/globalization.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/globinfo/Globalization.de-DE.js")" type="text/javascript"></script>
<script type="text/javascript">
$.validator.methods.number = function (value, element) {
    if (!isNaN(Globalization.parseFloat(value))) {
        return true;
    }
    return false;
}
$(document).ready(function () {
    $.culture = jQuery.cultures['de-DE'];
    $.preferCulture($.culture.name);
    Globalization.preferCulture($.culture.name);
});
</script>

这应该够了。