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.v21.1.dll

Declaration

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

Parameters

Type Description
T

The data item type.

Remarks

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