DxDataGridCommandColumn.CellTemplate Property

Specifies a template used to display the cell.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v21.1.dll

Declaration

[Parameter]
public RenderFragment<object> CellTemplate { get; set; }

Property Value

Type Description
RenderFragment<Object>

The template content.

Remarks

The CellTemplate property allows you to specify custom content for the command column’s cell. Use the context parameter to get information about the row.

<DxDataGrid Data="@DataSource">
    ...
    <DxDataGridCommandColumn Width="150px">
        @{
            var forecast = (context as WeatherForecast);
            <button type="submit" @onclick="@(() => OnEditButtonClick(forecast))">Edit</button>
            <button type="submit" @onclick="@(() => OnDeleteButtonClick(forecast))">Delete</button>
        }
    </DxDataGridCommandColumn>
</DxDataGrid>   

@code {
    WeatherForecast[] DataSource { get; set; }
    ...
    void OnEditButtonClick(WeatherForecast forecast) {
        // your code 
    }
    void OnDeleteButtonClick(WeatherForecast forecast) {
        // your code
    }
}

Custom buttons in the command column

Run Demo: Data Grid - Templates

See Also