Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GridRowExportingEventArgs.GroupFieldName Property

Returns the name of a data source field bound to the processed group column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public string GroupFieldName { get; }

#Property Value

Type Description
String

The field name or null if a data row is being processed.

#Remarks

The grid calls the RowExporting action before exporting a data or group row. You can use the IsGroupRow property to determine the type of the row currently being processed.

When exporting a group row, use the GroupFieldName property to get the group column’s data source field name. To obtain the group row value, call the GetRowValue(String) property.

C#
// Get value of the currently being processed group row
if (e.IsGroupRow) {
    var RowValue = e.GetRowValue(e.GroupFieldName);
}

If a data row is processed, the GroupFieldName property returns null.

The following code snippet hides City groups from the exported document.

razor
<DxGrid @ref="Grid" Data="@Data" >
    <Columns>
        <DxGridDataColumn FieldName="ContactName" />
        <DxGridDataColumn FieldName="CompanyName" />
        <DxGridDataColumn FieldName="Country" GroupIndex="0" />
        <DxGridDataColumn FieldName="City" GroupIndex="1" />
    </Columns>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
@code {
    IGrid Grid { get; set; }
    //...
    async Task ExportXlsx_Click() {
        var options = new GridXlExportOptions();
        options.RowExporting = (e) => {
            if (e.IsGroupRow && e.GroupFieldName == "City") {
                e.Cancel = true;
            }
        };
        await Grid.ExportToXlsxAsync("ExportResult", options);
    }
}

Grid - With Filtered Group Rows

See Also