Wrong currency unit in Kendo

你。 提交于 2019-12-24 15:08:41

问题


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, ..."


回答1:


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)



来源:https://stackoverflow.com/questions/30214813/wrong-currency-unit-in-kendo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!