I have the next problem:
I have a radgridview with data, but i need sum rows of the same column and i use the next code: (vb.net)
Dim summaryItem As New GridViewSummaryItem()
summaryItem.Name = "column6"
summaryItem.AggregateExpression = "(Sum(column6))"
Dim summaryRowItem As New GridViewSummaryRowItem()
summaryRowItem.Add(summaryItem)
Me.RadGridView1.SummaryRowsTop.Add(summaryRowItem)
but i dont know in what event is correctly put it.
I put it in a function but the SummaryRowsTop is repeated as many times as entry records.
i need only one SummaryRowsTop
5 Answers, 1 is accepted
Thank you for writing.
You can add your code to the form's constructor, or you can use the form's Load event.
Let me know if I can assist you further.
Regards,
Dimitar
Telerik by Progress
But i need get value of sum in a variable and do calculations.
I declare a variable Double and i assigned value of summaryItem. But not is correct. i need know how to assign the value of sum to variable
Thanks
Thank you for writing back.
If I understand correctly you would like to get the calculated value of the summary item and later use it according to your business logic.
The value of the summary item is dynamically calculated depending on your rows. In order to achieve your task, you would need to handle the GroupSummaryEvaluate event of the grid and check for the Value argument:
double
value;
private
void
radGridView1_GroupSummaryEvaluate(
object
sender, GroupSummaryEvaluationEventArgs e)
{
value = (
double
)e.Value;
}
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo Merdjanov
Telerik by Progress