2
votes

I'm using DevExpress, I created grid, made visible grid footer, where i can choose to show summary for every column when you press right click on footer, poops us menu where you can choose summary type. for example min,max, sum etc. I want to know is it possible to format values that are shown, setting summary in this way? Because, when I set summary to show me Max value it shows me "MAX = 10.0200", but I want to see only "MAX = 10.02".

this.colCostPrice.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] {
   new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum,
                                  "CostPrice", "SUM={0:n2}")});

there is code, how put the default summary (SUM), but when you choose summary, how i described before, there is no need to initialize summary, because format is set automaticaly.

Summary type is chosen like in this documentation (watch Group Summary Context Menus ) http://documentation.devexpress.com/#WindowsForms/CustomDocument700

2
could you show us the code where you are populating the summary values? - Răzvan Flavius Panda
It would be good if you create a short example to reproduce behavior. - Renatas M.

2 Answers

2
votes

If you wish to have two decimal places, use the "f2" format string.

1
votes

Use this: DisplayFormat = "{0:#,###.00}"