[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]ASP.NET WebForms Controls
   Getting Started
  [Collapse]Grid View
   [Expand]Product Information
    Getting Started
    [Expand]Binding to Data
    [Expand]Data Representation Basics
    [Expand]Focus and Navigation
    [Expand]Data Editing
    [Collapse]Data Shaping and Manipulation
     [Expand]Data Summaries
       Grouping Overview
       Grouping in Code
       Grouping Modes and Custom Grouping
       Expanding and Collapsing Group Rows
      Cell Merging
    [Expand]Data Formatting
    [Expand]Master-Detail Relationship
     Appearance Customization
     Save and Restore Layout
    ASPxGridView Designer
   [Expand]Visual Elements
   [Expand]Member Tables
   [Expand]ASPxGridView - Animated Images
  [Expand]Tree List
  [Expand]Card View
  [Expand]Chart Control
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Expand]Data Editors
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Controls
  [Expand]Spell Checker
  [Expand]Query Builder
 [Expand]ASP.NET MVC Extensions
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Grouping Modes and Custom Grouping

This topic illustrates how to group ASPxGridView data against one or multiple columns. The grouping feature combines rows with identical column values into the same data groups.

ASPxGridView provides multiple grouping modes - Interval Grouping and Merged Grouping.


Group modes and custom grouping described in this topic are not supported in server mode. Rows are always grouped by the grouping column values in this mode.

Expanded Group Modes

Interval grouping

Interval grouping allows you to change the default grouping logic, especially for columns that contain date/time values. For example, data rows can be arranged by the month or year part of a date/time value, while text columns can be grouped by the first characters. A column's GridViewDataColumnSettings.GroupInterval property specifies the interval grouping mode.

When grouping by date/time values, only the date portion of values is considered, while the time portion is ignored (by default). Rows that contain matching date portions, but different time portions in a grouping column, are combined into a single group. If grouping columns contain other data types, the default grouping logic is used. In this instance, rows are combined into a single group if they have a matching value in a grouping column.

Merged grouping

Merged grouping allows you to group grid data by several groups at once. To enable merged grouping, set the ASPxGridViewBehaviorSettings.MergeGroupsMode property to one of the following values:

  • Always - merge groups automatically;
  • Disabled - do not merge groups within the grid.

Use the following properties to customize the merged group's row:

Online demos:

Expanded Custom Grouping

You can implement your custom logic if the built-in grouping modes do not meet your requirements. To do this, set the GridDataColumnSettings.SortMode property to ColumnSortMode.Custom and handle the ASPxGridView.CustomColumnGroup event.

Note that you need to override both the ASPxGridView.CustomColumnGroup and ASPxGridView.CustomColumnSort events, because ASPxGridView's grouping logic is related to and based on ASPxGridView's sorting logic. Sorting grouped columns may not work correctly in some scenarios if only a single ASPxGridView.CustomColumnGroup event is handled.

Handling the ASPxGridView.CustomGroupDisplayText event might also be required to replace the default text displayed within group rows with custom content.

Expanded Example:

This example demonstrates how to implement custom grouping. The data is grouped by the 'Unit Price' column, and the column's rows that have values between 0 and 10 are combined into a single group. Rows whose values fall between 10 and 20 are combined into another group, etc.

The 'Unit Price' column's GridDataColumnSettings.SortMode property is set to 'Custom', and the ASPxGridView.CustomColumnGroup and ASPxGridView.CustomColumnSort events are handled identically.

Additionally, the ASPxGridView.CustomGroupDisplayText event is handled to replace the default text displayed within group rows.

The image below shows the result.


Refer to the How to implement custom grouping logic for ASPxGridView columns online example to review how it works.

Is this topic helpful?​​​​​​​