具有多种文化的MVC十进制分隔符

时间:2011-05-24 11:03:08

标签: .net asp.net-mvc globalization

我正在使用具有多种文化的应用程序,当我将文化'pt'更改为'en'时,小数分隔符将更改为。有办法修复小数分隔符?

感谢。

1 个答案:

答案 0 :(得分:5)

通过修改标准的CultureInfo滚动自己的var cInfo = CultureInfo.CreateSpecificCulture("en-us"); cInfo.NumberFormat.NumberDecimalSeparator = ","; cInfo.NumberFormat.CurrencyGroupSeparator = ","; cInfo.NumberFormat.PercentDecimalSeparator = ","; Thread.CurrentThread.CurrentCulture = cInfo; Thread.CurrentThread.CurrentUICulture = cInfo;

{{1}}