Skip to main content

GridRowExportingEventArgs.GroupFieldName Property

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

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

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.

// 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 code sample below demonstrates how to hide City groups from the exported document.

<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