Tip:
Highlight text to annotate it
X
Welcome to the Devexpress Learn Now Series. A set of quick tutorials to help you get started
using our controls. The Grid Control supports grouping data by any column or summary value.
In this video I’ll show you how to sort group rows by summary values of a specific
column, so let’s take a look… I already have a grid that is bound to the
Orders Table of the Sample Northwind Database. I’ll first switch to codeview and add references
to the following namespaces. Now, I’m going to create a grid summary
item object. I’ll then calculate the appropriate summary value for the Freight Column. The
code is placed in the form’s load event so that it’s triggered at runtime. I switch
back to design view and add a button to the form. I’ll set its caption to “Sort By
Summary”. I double-click the button to create a handler for its click event.
I add the following code to the event handler. This will first set Freight as the summary
column, then the group rows are sorted based on the maximum freight summary values in ascending
order. Let’s run the application and test the results….
I’ll group the rows by the ShipCountry Column. You’ll notice that the group rows now display
the Max value summary of each Country. I click on the Sort By Summary Button and all of the
groups are sorted in ascending order. Thanks for watching, let’s see what develops.