# Adding Groups to Tables

Table, Crosstab, and List items are template variations of the same Table data item and use row and column groups to organize data hierarchically. Unlike Report groups, table groups expand both horizontally (column groups) and vertically (row groups) to create flexible data layouts.

Use the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer) to add and manage groups in table items. You can create parent, child, adjacent, or details groups, and configure filtering, sorting, and aggregation settings for each group.

> tip The instructions in this article apply to all three template variations: Table, Crosstab, and List items.

## Add a Row/Column Group Using the Report Designer

### Add a Parent or Child Group

To add a parent or child row/column group:

1. Select the Table, Crosstab, or List item on the design surface.
2. In the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), right-click an existing group.
3. Click **Add Group**, and then click **Parent Group** or **Child Group** depending on where you want to add the group. The **Table Group** dialog box opens.
4. In the **Group by** section, click the **New** button.
5. Enter an expression for the grouping criteria (for example, `= Fields.Category`).
6. (Optional) Select **Add Header** to add a group header row or column.
7. (Optional) Select **Repeat On Every Page** to repeat the header on each page.
8. (Optional) Select **Add Footer** to add a group footer row or column.
9. (Optional) Select **Repeat On Every Page** to repeat the footer on each page.
   > tip The **Repeat On Every Page** functionality for group headers and footers was introduced in version `20.0.26.211`.
10. Click **OK**.

The group is added to the [Group Explorer grouping hierarchy](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), and the corresponding rows or columns are added to the data item on the design surface.

> tip When using **Repeat On Every Page**, you can display different content for repeated instances of the header or footer. Use the [`ReportItem.IsRepeated`](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/expressions/expressions-reference/global-objects#reportitem) property in expressions to conditionally modify the displayed content, for example, appending "(continued)" text. For more details, see [Display Continued Text for Repeated Table Group Headers](https://www.telerik.com/products/reporting/documentation/knowledge-base/display-continued-text-repeatable-group-headers).

### Add an Adjacent Group

To add an adjacent row/column group:

1. Select the Table, Crosstab, or List item on the design surface.
2. In the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), right-click an existing group.
3. Click **Add Group**, and then click **Adjacent Above** or **Adjacent Below** to specify where to add the group. The **Table Group** dialog box opens.
4. In the **Group by** section, click the **New** button.
5. Enter an expression for the grouping criteria (for example, `= Fields.Category`).
6. (Optional) Select **Add Header** to add a group header row or column.
7. (Optional) Select **Repeat On Every Page** to repeat the header on each page.
8. (Optional) Select **Add Footer** to add a group footer row or column.
9. (Optional) Select **Repeat On Every Page** to repeat the footer on each page.
   > tip The **Repeat On Every Page** functionality for group headers and footers was introduced in version `20.0.26.211`.
10. Click **OK**.

The group is added to the [Group Explorer grouping hierarchy](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer) at the specified position, and the corresponding rows or columns are added to the data item on the design surface.

> tip When using **Repeat On Every Page**, you can display different content for repeated instances of the header or footer. Use the [`ReportItem.IsRepeated`](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/expressions/expressions-reference/global-objects#reportitem) property in expressions to conditionally modify the displayed content, for example, appending "(continued)" text. For more details, see [Display Continued Text for Repeated Table Group Headers](https://www.telerik.com/products/reporting/documentation/knowledge-base/display-continued-text-repeatable-group-headers).

> caution Repeatable headers and footers are not compatible with the `PageBreak` property. If any group in the table has a `PageBreak` value other than `None`, repeatable headers and footers will not be processed and rendered, even if `PrintOnEveryPage` is enabled.

## Add a Details Group Using the Report Designer

A details group displays individual data records without grouping. For row groups, this creates a row for each record; for column groups, this creates a column for each record.

To add a details group:

1. Select the Table, Crosstab, or List item on the design surface.
2. In the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), right-click the innermost child group.
3. Click **Add Group**, and then click **Child Group**. The **Table Group** dialog box opens.
4. Select **Show detail data**.
5. Click **OK**.

The details group is added to the [Group Explorer grouping hierarchy](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer) and displays the details group icon. A new row (for row groups) or column (for column groups) is added to the table to display the detail data.

## Edit an Existing Group

To edit an existing group's properties, including grouping expressions, sorting, filtering, and other settings:

1. Select the Table, Crosstab, or List item on the design surface.

2. In the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), right-click the group, and then click **Group Properties**.

3. Configure the group properties:

   * **GroupKeepTogether**—Specify the keep together options to control whether group content stays together across page breaks.
   * **PageBreak**—Specify where page breaks occur relative to the group.
   * **PrintOnEveryPage**—Controls whether the corresponding header or footer row/column repeats on every page. This property is respected only on static groups. See [Edit the Repeat On Every Page Behavior](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/data-items/grouping-data/how-to-add-groups-to-table-item-and-crosstab-item#edit-the-repeat-on-every-page-behavior) for details.
   * **Visible**—Control the visibility of the group.
   * **Filters**—Click the ellipsis to configure filters. Click **New** to add a filter, then specify the **Expression**, **Operator**, and **Value**.
   * **Groupings**—Click the ellipsis to add or modify grouping expressions. Click **New** to add additional expressions. All expressions are combined using a logical AND.
   * **Sortings**—Click the ellipsis to configure sort order. Click **New** to add a sort expression, then choose **ASC** (ascending) or **DESC** (descending) from the **Direction** drop-down list.
   * **BookmarkId**—Set a bookmark identifier for this group.
   * **DocumentMapText**—Specify the text to display in the document map for this group.
   * **TocText**—Specify the text to display in the table of contents for this group.
   * **Name**—Enter the name of the group.

4. Click **OK**.

### Page Breaks for Table Detail Rows

The details group repeats for each data record. To introduce additional page breaks between rows, in the Standalone Report Designer:

1. Select the Table item on the design surface. If you have selected an item or a cell inside the table, click the **Escape** key until the focus changes to the table item.
2. In the [Group Explorer](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), locate the details group under **Row Groups**. If the table needs a details group, follow [Add a Details Group Using the Report Designer](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/data-items/grouping-data/how-to-add-groups-to-table-item-and-crosstab-item#add-a-details-group-using-the-report-designer).
3. Right-click the details group and select **Group Properties**.
4. Configure the group's `PageBreak` property. Its values are `None`, `Before`, `After`, and `BeforeAndAfter`.

| PageBreak Setting | Behavior                                                                |
| ----------------- | ----------------------------------------------------------------------- |
| `Before`          | Applies a page break before each row, except the first row.             |
| `After`           | Applies a page break after each row, except the last row.               |
| `BeforeAndAfter`  | Combines both behaviors: applies page breaks before and after each row. |

> note The `TableGroup.PageBreak` is an enum property, and the `TableGroup` does not expose the report-item `Bindings` collection. The binding example in [Conditional Page Breaks](https://www.telerik.com/products/reporting/documentation/knowledge-base/conditional-page-breaks) applies to a report section. Do not transfer it directly to the TableGroup property.

### Edit the Repeat On Every Page Behavior

When you enable **Repeat On Every Page** for a header and/or footer while creating a [dynamic group](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/data-items/grouping-data/overview) in the [Table Group Dialog](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/table-group-dialog), the designer sets the `PrintOnEveryPage` property to `True` on the corresponding [static group](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/data-items/grouping-data/overview). Static groups have no grouping expressions—they represent fixed structural rows or columns that serve as group headers and footers.

To change the repeat behavior after group creation:

1. Select the Table, Crosstab, or List item on the design surface.

2. In the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), switch to **Extended Mode**. Static groups are hidden in the default Standard Mode.

   ![Telerik Reporting Standalone Report Designer Group Explorer highlighting the Extended Mode option for static and dynamic table groups.](https://www.telerik.com/products/reporting/documentation/assets/e643996604f588dd524c16c6d51d168e/extended-mode-group-explorer.png)

3. Locate the leaf static group that represents the header or footer you want to modify. Static groups appear with a distinct icon and gray text.

   Each dynamic group owns its header as the **first child** static group and its footer as the **last child** static group. However, when groups are nested, outer dynamic groups produce a chain of static groups rather than a single one: there is a non-leaf static group at the outer level wrapping a leaf at the inner level. `PrintOnEveryPage` is only respected on the **leaf** at the end of that chain.

   To find the correct leaf: start from the dynamic group whose header or footer you want to change → select its first child (header) or last child (footer) static group → keep following the child chain until you reach one with no children. That is the leaf to edit.

   For example, the sample report [`RepeatableTableGroupHeadersFootersDemo.trdx`](https://github.com/telerik/reporting-samples/blob/master/RepeatableTableGroupHeadersFootersDemo/RepeatableTableGroupHeadersFootersDemo.trdx) has a *productCategory* group containing a nested *productSubCategory* group. The resulting row group hierarchy in Extended Mode is:

   ```
   productCategory (dynamic)
   ├── group1 (static, non-leaf)          ← Category header chain start
   │   └── group2 (static, leaf) ✔        ← set PrintOnEveryPage here for Category header
   ├── productSubCategory (dynamic)
   │   ├── group (static, leaf) ✔          ← set PrintOnEveryPage here for Subcategory header
   │   ├── detail
   │   └── group3 (static, leaf) ✔         ← set PrintOnEveryPage here for Subcategory footer
   └── group4 (static, non-leaf)          ← Category footer chain start
       └── group5 (static, leaf) ✔         ← set PrintOnEveryPage here for Category footer
   ```

   The outer *productCategory* header and footer each have a two-level static chain (`group1→group2` and `group4→group5`), while the inner *productSubCategory* header and footer are direct leaf children.

   The screenshot below shows this hierarchy in the Group Explorer alongside the corresponding table rows on the design surface:

   ![Telerik Reporting Standalone Report Designer Group Explorer in Extended Mode with a table selected to show group hierarchy](https://www.telerik.com/products/reporting/documentation/assets/b6ddd98726b04c7c18896c6080b3111a/extended-mode-group-explorer-table.png)

4. Double-click the leaf static group to open the **Group Properties** editor.

5. Set `PrintOnEveryPage` to `True` to repeat the header/footer on every page, or `False` to disable repeating.

6. Click **OK**.

> tip To control the content displayed in repeated headers or footers, use the [`ReportItem.IsRepeated`](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/expressions/expressions-reference/global-objects#reportitem) property in expressions. For example, you can append "(continued)" text to repeated headers. See [Display Continued Text for Repeated Table Group Headers](https://www.telerik.com/products/reporting/documentation/knowledge-base/display-continued-text-repeatable-group-headers).

## Delete a Group Using the Report Designer

To delete a group:

1. Select the Table, Crosstab, or List item on the design surface.

2. In the [Group Explorer grouping pane](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/group-explorer), right-click the group, and then click **Delete Group**.

3. In the **Delete Group** dialog box, select one of the following options:

   * **Delete group and related rows and columns**—Choose this option to delete the group definition and all related rows and columns that display group data. For the details group, if the same row or column belongs to both detail and group data, only the detail data rows and columns are deleted.
   * **Delete group only**—Choose this option to keep the structure of the data item and delete only the group definition.

4. Click **OK**.

## Add a Group Programmatically

You can find below a C# and VB.NET example for adding a table group programmatically:

```C#

Telerik.Reporting.TableGroup group1 = new Telerik.Reporting.TableGroup();
group1.Name = "ProductID1";
group1.Groupings.Add(new Telerik.Reporting.Grouping("=Fields.ProductID"));

// If you need to filter the members of the group, apply filtering
group1.Filters.Add(new Telerik.Reporting.Filter("=Fields.ProductID", Telerik.Reporting.FilterOperator.Equal, "=10"));

// If you need to order the members of the group, apply sorting
group1.Sortings.Add(new Telerik.Reporting.Sorting("=Fields.ProductID", Telerik.Reporting.SortDirection.Asc));

Telerik.Reporting.TextBox textBox1 = new Telerik.Reporting.TextBox();
table1.Items.Add(textBox1);
group1.ReportItem = textBox1;

table1.RowGroups.Add(group1);
```

```VB.NET

Dim group1 As New Telerik.Reporting.TableGroup()
group1.Name = "RowGroup1"
group1.Groupings.Add(New Telerik.Reporting.Grouping("=Fields.ProductID"))

' If you need to filter the members of the group, apply filtering
group1.Filters.Add(New Telerik.Reporting.Filter("=Fields.ProductID", Telerik.Reporting.FilterOperator.Equal, "=10"))

' If you need to order the members of the group, apply sorting
group1.Sortings.Add(New Telerik.Reporting.Sorting("=Fields.ProductID", Telerik.Reporting.SortDirection.Asc))

Dim textBox1 As New Telerik.Reporting.TextBox()
table1.Items.Add(textBox1)
group1.ReportItem = textBox1

table1.RowGroups.Add(group1)
```

## See Also

* [Table Group Dialog (Desktop Designers)](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/desktop-designers/tools/table-group-dialog)
* [Table Group Dialog (Web Report Designer)](https://www.telerik.com/products/reporting/documentation/designing-reports/report-designer-tools/web-report-designer/tools/table-group-dialog)
* [Grouping Data Overview](https://www.telerik.com/products/reporting/documentation/designing-reports/connecting-to-data/data-items/grouping-data/overview)
* [Display Continued Text for Repeated Table Group Headers](https://www.telerik.com/products/reporting/documentation/knowledge-base/display-continued-text-repeatable-group-headers)
* [ColumnGroups](https://www.telerik.com/products/reporting/documentation/api/telerik.reporting.table#Telerik_Reporting_Table_ColumnGroups)
* [RowGroups](https://www.telerik.com/products/reporting/documentation/api/telerik.reporting.table#Telerik_Reporting_Table_RowGroups)
