DxDataGrid<T>.CancelRowEdit() Method

Asynchronously closes the edit form and does not save changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public Task CancelRowEdit()

Returns

Type Description
Task

An asynchronous operation that closes the edit form.

Remarks

Use the CancelRowEdit method to close the edit form and discard changes that users made. The RowEditCancel and RowEditCancelAsync events are fired when you call this method.

NOTE

This method does not discard changes that were accepted and passed to the data item.

The following code snippet demonstrates how to implement a custom Cancel button outside the Data Grid:

<button id="cancelButton" @onclick="@Cancel">Cancel</button>

<DxDataGrid DataAsync="@ForecastService.GetForecastAsync"
            @ref="MyGrid" ...>
        <DxDataGridColumn Field=@nameof(WeatherForecast.TemperatureC) Caption="Temp. (C)"></DxDataGridColumn>
        ...
</DxDataGrid>

@functions {
    DevExpress.Blazor.DxDataGrid<WeatherForecast> MyGrid;

    async Task Cancel() {
        await MyGrid.CancelRowEdit();
    }
}
See Also