This is a migrated thread and some comments may be shown as answers.

[Solved] Gridview sum format

1 Answer 143 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rama
Top achievements
Rank 1
Rama asked on 14 Feb 2011, 02:02 PM
Hi,

I'm using the following format for displaying value:

gridColumn.AggregateFunctions.Add(new SumFunction() { SourceField = string.Format("DataPoints[{0}]", measure), Caption = "Sum:", ResultFormatString = "{}{#.##}", SourceFieldType = Type.GetType("System.Double") });

I would like to use just 2 decimal places but I'm not sure what's being used under the hood!  It never brings any value!

for e.g if the sum is 23333.567899 then I would like to display 23333.56 or 23333.57

Thanks,Rama

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 14 Feb 2011, 02:29 PM
Hi Rama,

You may define the aggregate function as follows:

GridViewDataColumn column = new GridViewDataColumn();
column.DataMemberBinding = new Binding("Number");
column.AggregateFunctions.Add(new SumFunction() { Caption = "Sum: ", ResultFormatString = "{0:#.##}"});

 

Greetings,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
GridView
Asked by
Rama
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or