Last year I described a way to display accurate row count when grid in OutlookGroupBy mode has multiple sub-groups.
That solution requires custom counting function. Fortunately to display aggregates such as SUM, AVG, MIN and MAX UltraWebGrid has a built-in functionality in form of GroupByRowDescriptionMaskDefault property of DisplayLayout. It specifies the string to be displayed in every GroupBy row and can include following substitutes:
- [caption] – will display GroupBy column header text
- [value] – will display common to the group cell value
- [count] – will display row count (does not work correctly with sub-groups)
- [avg], [sum], [min], [max] – will display the aggregate for the column it’s grouped by
- [avg:ColumnKey], [sum:ColumnKey], [min:ColumnKey], [max:ColumnKey] – will display the aggregate for any other column, where ColumnKey is the key of the column
With this in mind in just a few simple steps we can make UltraWebGrid to display something like this: