Skip to main content

CellEditContext.OnChanged(String, Object) Method

A delegate method that handles a cell value change in the specified column.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public void OnChanged(
    string fieldName,
    object value
)

Parameters

Name Type Description
fieldName String

A data source field name.

value Object

A cell value.

Remarks

When you use an edit template, the editors inside this template do not inform the grid about changes made to their values. If you have complex dependencies between editors, call the OnChanged method to inform the editors about changes and save the new cell values to the EditedValues collection. Then, the grid passes this collection to the RowUpdating and RowInserting events.

<DxDataGrid Data="@DataSource"
    RowInserting="@((newValues) => OnRowInserting(newValues))"
    RowUpdating="@((updatingDataItem, newValues) => OnRowUpdating(updatingDataItem, newValues))">
    ...
    <DxDataGridComboBoxColumn Field="@nameof(Vacancy.Region)" Data="@VacancyRepository.Regions">
        <EditTemplate>
            @{
                var editingContext = (CellEditContext)context;
            }
            <DxComboBox Data="@VacancyRepository.Regions"
                Value="@region"
                ValueChanged="@((string newCellValue) => {
                    editingContext.OnChanged(newCellValue);
                    editingContext.OnChanged(nameof(Vacancy.City), null);
                })">
            </DxComboBox>
        </EditTemplate>
    </DxDataGridComboBoxColumn>
</DxDataGrid>

Run Demo: Data Grid - Templates

See Also