We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to best group and sum across a model

Thread ID:





80284 Mar 26,2009 11:36 AM Apr 1,2009 12:22 PM Windows Forms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On March 26, 2009 11:36 AM

Hi -
I've been looking around for a solution to a problem for a while, perhaps syncfusion could offer that solution.

I have the following model:

OrderId User Price Quantity
101 John 7.75 100
102 Fred 8.00 150
103 John 7.75 200
104 John 8.00 125

And I'd like to create a view into this model that groups on Price & User and sums the quantities then sorts by price so the view would look like:

User Price Quantity
John 7.75 300 <-- Grouped & Summed
Fred 8.00 150
John 8.00 125

Is this possible with some of the syncfusion grouping or grid functionality?

Any thoughts about the best way to accomplish this?

Thanks - have a great morning!

Lingaraj S [Syncfusion]
Replied On March 28, 2009 03:06 AM


Thanks for your interest in syncfusion products.

This functionality can be achieved by adding the group summary value in group header in GridGroupingControl, please try to use CaptionText and CaptionSummaryRow property.

Please refer the sample below:

Let me know if it helps.

Lingaraj S

Administrator [Syncfusion]
Replied On March 30, 2009 03:49 PM

Thank you for the response.
This looks like it could be a solution to my problem - the grouping and summing is exactly what I'd like - however, is it possible to remove all of the collapsible rows and render the cells as a flat grid (just a grid with the view that I describe in my earlier request)?

Ultimately, the view shouldn't reveal the original model or any of the logic correlated with developing the view - in this case, it should just show the Name, Price, and Summed Quantity.

Thanks again for your assistance,

Administrator [Syncfusion]
Replied On March 31, 2009 12:49 PM


Yes, this is definitely possible. We will provide you an updated sample soon.


Administrator [Syncfusion]
Replied On April 1, 2009 12:22 PM


Here is the updated sample that does exactly what you want.

There is source code comments in the sample that should tell you how this is implemented. Let us know if you have any questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.