Skip to main content

GridExportOptions.ExportSelectedRowsOnly Property

Specifies if the grid exports only selected rows.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(false)]
public bool ExportSelectedRowsOnly { get; set; }

Property Value

Type Default Description
Boolean false

true to export the selected rows only; false to export all grid rows.

Property Paths

You can access this nested property as listed below:

Object Type Path to ExportSelectedRowsOnly
GridExportEventArgs
.Options .ExportSelectedRowsOnly

Remarks

Set the ExportSelectedRowsOnly property to true to export selected rows only. If you want to do so when the Grid component is bound to a GridDevExtremeDataSource object, specify the KeyFieldName property.

The following code snippet activates this option:

<DxGrid @ref="@Grid" Data="Orders" AllowSelectRowByClick="true" >
    <Columns>
        <DxGridSelectionColumn />
        <DxGridDataColumn FieldName="ShipName" />
        <DxGridDataColumn FieldName="ShipCity" />
        <DxGridDataColumn Caption="Date" FieldName="RequiredDate" />
    </Columns>
</DxGrid>
<DxButton Text="Export to XLSX" Click="ExportXlsx_Click" />
@code {
    IGrid Grid { get; set; }
    IEnumerable<Order> Orders { get; set; }
    protected override async Task OnInitializedAsync() {
        Orders = await NwindDataService.GetOrdersAsync();
    }
    async Task ExportXlsx_Click() {
        var options = new GridXlExportOptions();
        options.ExportSelectedRowsOnly = true;
       await Grid.ExportToXlsxAsync("ExportResult", options);
    }
}

Run Demo: Grid - Export Data

For more information about data export in the Grid component, refer to the following topic: Export Data in Blazor Grid.

See Also