【问题标题】:How to add currency format to Data Row in AspxPivotGrid by Programmatically?如何以编程方式将货币格式添加到 AspxPivotGrid 中的数据行?
【发布时间】:2017-06-07 15:04:56
【问题描述】:

我想在 AspxPivotGrid 表的数据行中添加货币格式。 你可以看到下面的图片,它现在是如何显示的。所以我只想将货币格式显示到 3 个字段(ExtendedPrice、ExtendedCost、Profit)

这是我的 C# 代码:

if (i == 8 || i == 9 || i == 10 || i == 11)
{
    DevExpress.Web.ASPxPivotGrid.PivotGridField newF = new DevExpress.Web.ASPxPivotGrid.PivotGridField(names[i], PivotArea.DataArea);
    newF.ID = "field" + newF.FieldName;
    //newF.ValueFormat.FormatType=
    ASPxPivotGrid1.Fields.Add(newF);
}

【问题讨论】:

    标签: c# asp.net gridview devexpress aspxgridview


    【解决方案1】:

    根据这个文档 (FormatInfo),我认为应该这样设置:

    newF.ValueFormat.FormatType = FormatType.Numeric;
    newF.ValueFormat.FormatString = "c2";
    

    【讨论】:

      【解决方案2】:

      这可能对你有用

      newF.ValueFormat-FormatString = "c2";
      newF.ValueFormat-FormatType = "Numeric";
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-07-07
        • 1970-01-01
        • 1970-01-01
        • 2019-10-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多