.NET MVC4文化设置正确,但仍然验证英语 [英] .Net MVC4 Culture set correct, but validation still English

查看:94
本文介绍了.NET MVC4文化设置正确,但仍然验证英语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常基本的.MVC网站,使用丹麦语。

I have a very basic .MVC site, that uses Danish language.

我可以在页面的开头设定的文化:

I could set the Culture in the beginning of the page:

@{
    Layout = null;
    Culture = "da-DK";
}

但它已经是正确的,所以我怀疑它的问题。

But it is already correct, so I doubt it matters.

然后,我有我的输入字段:

Then I have my input field:

@Html.EditorFor(model => model.Price)

这是在模型小数。

It is a decimal in the model.

然后我有提交按钮

<input type="submit" value="Opret" />

我不知道它的问题,但是我用的是相同的部分视图编辑和创建的,但文化也是在内部观点是正确的。

I don't know if it matters, but I use the same partial view for edit and create, but culture is also correct in the inner view.

当我在价格字段中插入5,60则抱怨并说,它应该是一个数字。

When I insert 5,60 in the Price field then it complains and says that it should be a number.

我是什么失踪?

(我道歉,如果这已经被问过,我实在找不到它。)

(I apologize if this has been asked before, I really couldn't find it.)

推荐答案

您已经在你的问题中提到的问题属于未完全ASP.NET MVC支持的全球化。所以,你需要在下面的帖子中描述的一些变化。

The problem you have mentioned in your question falls into the globalization that is not completely supported by ASP.NET MVC. So you need some changes that is described in the following post.

ASP.NET MVC 4 jQuery验证全球化

这篇关于.NET MVC4文化设置正确,但仍然验证英语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆