2

I want to add currency format to Data Row in AspxPivotGrid table. You can see the below picture,how it is displaying now. So I just want to display currency format to 3 fields (ExtendedPrice,ExtendedCost,Profit)

Now how it is displaying

This is my c# code:

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);
}
Mohit S
  • 13,723
  • 6
  • 34
  • 69

2 Answers2

0

This might do the trick for you

newF.ValueFormat-FormatString = "c2";
newF.ValueFormat-FormatType = "Numeric";
Mohit S
  • 13,723
  • 6
  • 34
  • 69
0

Per this doc (FormatInfo) I think it should be set like that:

newF.ValueFormat.FormatType = FormatType.Numeric;
newF.ValueFormat.FormatString = "c2";
andrews
  • 2,173
  • 2
  • 16
  • 29