Skip to main content

DxDataGrid<T>.RowRemovingAsync Event

Occurs when a user removes a data row and allows you to await handler execution without blocking the Data Grid.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v22.1.dll

Declaration

[Parameter]
public Func<T, Task> RowRemovingAsync { get; set; }

Parameters

Type Description
T

The data item type.

Remarks

Important

The Data Grid was moved to maintenance support mode. No new features/capabilities will be added to this component. We recommend that you migrate to the Grid component.

Handle the RowRemovingAsync event to remove the data item from the Data Grid’s data source or discard changes.

To control the visibility of the Delete command button, use the DeleteButtonVisible property.

@inject MyApp.Data.WeatherForecastService ForecastService
@using MyApp.Data

<DxDataGrid DataAsync="@ForecastService.GetForecastAsync" 
            RowRemovingAsync="@OnRowRemoving">
    <DxDataGridCommandColumn />
    <DxDataGridDateEditColumn Field=@nameof(WeatherForecast.Date) />
    <DxDataGridSpinEditColumn Field="@nameof(WeatherForecast.TemperatureC)" 
                              Caption="@("Temp. (\x2103)")" />
    <DxDataGridColumn Field=@nameof(WeatherForecast.TemperatureF) Caption="Temp. (F)" />
</DxDataGrid>

@code {
    async Task OnRowRemoving(WeatherForecast dataItem) {
        await ForecastService.Remove(dataItem);
    }
}

Note

If you bind the data grid to a data source that does not implement the INotifyCollectionChanged interface, you should reload data and redraw the grid after a row is deleted. To do this, use the Refresh method in the OnRowRemoving handler.

See Also