剑道的货币单位错误 [英] Wrong currency unit in Kendo

查看:117
本文介绍了剑道的货币单位错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站上,我使用剑道网格. 在该网格中,具有这些值的列"Amount":

您看到金额前有美元符号,但我想要欧元符号.

全球化文化设置是正确的,因为当我在网格外显示金额时,它会显示带有欧元符号的金额.

我正在使用ASP.NET MVC5开发此网站. 在我的模型中,我具有以下属性:

[DisplayFormat(DataFormatString = "{0:c}")]
public decimal Amount { get; set; }

您看到我将字符串格式化为货币(并且我的全球化文化设置正确)

有人可以帮我吗?

注意:这不是将金额转换为字符串的选项,因为我必须对该列进行排序.对于字符串,它无法像普通的小数一样对数字进行排序.字符串将按照"1、1、2、2、20、3"而不是"1、2、3,..."进行排序

解决方案

当您说您已包含正确的全球化设置时,您如何进行此操作,例如通过web.config之类的:

  <system.web>
    <globalization culture="en-GB" uiCulture="en-GB" />
  </system.web>

或通过C#例如

Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-GB");
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-GB"); 

假设您是在网站上设置文化的方式,同时还将相关的Kendo Culture脚本包含到您的网站中:

例如

<script src="@Url.Content("~/Scripts/kendo/2015.1.511/cultures/kendo.culture.en-GB.min.js")"></script>

注意:将版本和区域性设置更改为您的版本和所需的区域性,例如fr-FR,en-US等 然后像这样设置包含的区域性:

<script type="text/javascript">
      kendo.culture("en-GB");
</script>

注意:更改区域性脚本中指定的区域性,请更改en-GB.

这将设置所有kendo控件使用相同的区域性,而不必为每个控件指定它.

有关更多详细信息,请参见此链接: Kendo全球化帮助

希望这对您有所帮助.任何问题都让我知道,希望我们能找出使用en-US设置的原因(这是kendo控件的默认语言)

In my website I use the Kendo-grid. In that grid, there is a column "Amount" with these values:

You see that there are dollar-signs before the amounts, but I want euro-signs.

The globalization-culture settings are correct, because when I show an amount outside the grid, it shows me the amount with a euro-sign.

I'm developing this website with ASP.NET MVC5. In my model I have this property:

[DisplayFormat(DataFormatString = "{0:c}")]
public decimal Amount { get; set; }

You see that I format my string to currency (and my globalization-culture settings are correct)

Could anyone help me please?

Note: It is not an option to convert the amount to a string, because I have to sort that column. And with strings, it is unable to sort numbers like normal decimals. Strings will be sorted like "1, 11, 2, 20, 3" instead of "1, 2, 3, ..."

解决方案

When you say you have included the correct Globalization settings how are you doing this e.g. via web.config like:

  <system.web>
    <globalization culture="en-GB" uiCulture="en-GB" />
  </system.web>

or via C# e.g.

Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-GB");
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-GB"); 

Assuming these are the ways you are setting the culture for your site have you also include the relevant Kendo Culture script onto your site:

eg.

<script src="@Url.Content("~/Scripts/kendo/2015.1.511/cultures/kendo.culture.en-GB.min.js")"></script>

Note: change version and culture settings to your version and required culture e.g. fr-FR, en-US etc and then setting the included culture like so:

<script type="text/javascript">
      kendo.culture("en-GB");
</script>

Note: Change the en-GB for whatever culture you have specified in the culture script.

This will then set all the kendo controls use the same culture and you don't have to specify it per control.

see this link for more details: Kendo Globalization Help

Hopefully this will help you out. Any issues let me know and hopefully we can find out why the en-US setting is being used (it is the default language for the kendo controls)

这篇关于剑道的货币单位错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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