【问题标题】:How to Currency Format used in JSON mode MVC?如何在 JSON 模式 MVC 中使用货币格式?
【发布时间】:2013-05-31 11:10:21
【问题描述】:

我是 JSON 模式的新手。我正在尝试将这种格式绑定到模型,但它不起作用。有人知道这个问题吗?

.Column(col =>
{
    col.Add(c => c.Freight).Format("{0:$####.##}").HeaderText("Doller");
    col.Add(c => c.Freight).Format("{0:####.## GBP}").HeaderText("GBP");
    col.Add(c => c.Freight).Format("{0:$####.## JPY}").HeaderText("JPY");
    col.Add(c => c.Freight).Format("{0:####.##}").HeaderText("Rupees");
}

【问题讨论】:

  • 定义“不工作”。有什么错误吗?
  • 不工作如果我使用日期格式它工作
  • 您应该详细说明您的问题。表示您尝试过的内容和得到的正确结果(显示正确结果)以及遇到的错误(也显示错误),以便这里的每个人都可以帮助您。

标签: json model-view-controller


【解决方案1】:

试试这个

.Column(col => {
col.Add(c => c.Freight).Format("{$####.##}").HeaderText("Doller");
col.Add(c => c.Freight).Format("{####.## GBP}").HeaderText("GBP");
col.Add(c => c.Freight).Format("{$####.## JPY}").HeaderText("JPY");
col.Add(c => c.Freight).Format("{####.##}").HeaderText("Rupees"); }

【讨论】:

  • 我不应该打印 $####.##。我只需要这种格式。
猜你喜欢
  • 2012-05-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多