asp.net中的货币格式字符串

Mr *_*r W 7 c# asp.net currency cultureinfo

我使用的是infragistics webgrid,需要格式化货币字符串.为此我需要一个包含模式的字符串,例如"$ ### ###,00",我希望这可以从我目前的CultureInfo中找到.我怎样才能做到这一点?我是否需要从以下信息中手动撰写:

CultureInfo.CreateSpecificCulture(myLanguageId).NumberFormat.CurrencyGroupSeparator
CultureInfo.CreateSpecificCulture(myLanguageId).NumberFormat.CurrencyGroupSizes
CultureInfo.CreateSpecificCulture(myLanguageId).NumberFormat.CurrencyDecimalDigits
CultureInfo.CreateSpecificCulture(myLanguageId).NumberFormat.CurrencyDecimalSeparator
Run Code Online (Sandbox Code Playgroud)

等等

这是单线解决方案吗?

Gre*_*ean 11

decimal moneyvalue = 1921.39m;
string s = String.Format("{0:C}", moneyvalue);
Run Code Online (Sandbox Code Playgroud)

将使用当前的文化.

确保web.config中包含以下内容:

<system.web>
   <globalization culture="auto" uiCulture="auto"/>
</system.web>
Run Code Online (Sandbox Code Playgroud)

或者如ck建议的那样,在你的页面中声明等价物


Mr *_*r W 1

感谢您的所有回答。事实证明我的要求是错误的。基础设施网格不需要模式字符串来知道使用哪些分隔符,它使用小数等的模式字符串,然后查询有关其余部分的当前区域性。所以这不是问题。不管怎么说,还是要谢谢你!