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

Agreggate Expression / Summary Rows

5 Answers 118 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Javier
Top achievements
Rank 1
Javier asked on 08 Jul 2016, 04:03 AM

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

Sort by
0
Dimitar
Telerik team
answered on 08 Jul 2016, 09:09 AM
Hi Javier,

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
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Javier
Top achievements
Rank 1
answered on 08 Jul 2016, 02:55 PM
is perfect. tanks
0
Javier
Top achievements
Rank 1
answered on 08 Jul 2016, 05:15 PM
But i need      
0
Javier
Top achievements
Rank 1
answered on 08 Jul 2016, 05:20 PM

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

 

0
Hristo
Telerik team
answered on 11 Jul 2016, 12:07 PM
Hello Javier,

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
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Tags
GridView
Asked by
Javier
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Javier
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or