CellEditContext.CellValue Property

Returns the current cell value.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

public virtual object CellValue { get; }

Property Value

Type Description
Object

A cell value.

Remarks

The CellValue property provides the current cell value.

<DxDataGrid Data="@DataSource">
    ...
    <DxDataGridColumn Field="@nameof(Product.ProductCategoryId)" >
        <EditTemplate>
            @{ 
                var cellEditContext = (CellEditContext)context;
                int currentCellValue = (int)cellEditContext.CellValue;
                var nestedItem = NestedDataSource.Where(x => x.ProductSubcategoryID == currentCellValue).FirstOrDefault();
            }
        </EditTemplate>
    </DxDataGridColumn>

</DxDataGrid>

@code {
    IEnumerable<Product> DataSource;
    IEnumerable<ProductCategory> NestedDataSource;

    protected override async Task OnInitializedAsync()
    {
        DataSource = await ProductService.LoadAsync();
        NestedDataSource = await ProductCategoriesProvider.GetProductCategoriesAsync();
    }
}

Online Demo

Data Grid - Templates

See Also