Skip to main content
All docs
V25.2
  • DxGridCommandColumn.DisplayMode Property

    Specifies whether command buttons display icons, captions, or both.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    Declaration

    [DefaultValue(GridCommandColumnDisplayMode.Icon)]
    [Parameter]
    public GridCommandColumnDisplayMode DisplayMode { get; set; }

    Property Value

    Type Default Description
    GridCommandColumnDisplayMode Icon

    An enumeration value.

    Available values:

    Name Description Image
    Icon

    Command buttons display icons.

    Icon Display Mode

    Text

    Command buttons display captions.

    Text Display Mode

    IconAndText

    Command buttons display captions and icons.

    IconAndText Display Mode

    Remarks

    In the following example, the Grid component displays both icons and captions in command buttons:

    IconAndText Display Mode

    @using Microsoft.EntityFrameworkCore
    @inject NwindDataService NwindDataService
    @inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
    @implements IDisposable
    
    <DxGrid Data="Data"
            KeyFieldName="EmployeeId"
            ShowFilterRow="true"
            EditModelSaving="OnEditModelSaving"
            DataItemDeleting="OnDataItemDeleting"
            CustomizeEditModel="OnCustomizeEditModel"
            EditMode="GridEditMode.EditRow">
        <Columns>
            <DxGridCommandColumn DisplayMode="GridCommandColumnDisplayMode.IconAndText" />
            <DxGridDataColumn FieldName="FirstName" />
            <DxGridDataColumn FieldName="LastName" />
            <DxGridDataColumn FieldName="Title" />
            <DxGridDataColumn FieldName="HireDate" />
        </Columns>
    </DxGrid>
    
    @code {
        IEnumerable<Employee> Data { get; set; }
        NorthwindContext Northwind { get; set; }
    
        protected override async Task OnInitializedAsync() {
            Northwind = NorthwindContextFactory.CreateDbContext();
            Data = await Northwind.Employees.ToListAsync();
        }
    
        void OnCustomizeEditModel(GridCustomizeEditModelEventArgs e) {
            if(e.IsNew) {
                var editModel = (Employee)e.EditModel;
                editModel.EmployeeId = Data.Max(x => x.EmployeeId) + 1;
            }
        }
    
        async Task OnEditModelSaving(GridEditModelSavingEventArgs e) {
            var editModel = (Employee)e.EditModel;
            if (e.IsNew)
                await Northwind.AddAsync(editModel);
            else
                e.CopyChangesToDataItem();
            // Post changes to the database.
            await Northwind.SaveChangesAsync();
            // Reload the entire Grid.
            Data = await Northwind.Employees.ToListAsync();
        }
    
        async Task OnDataItemDeleting(GridDataItemDeletingEventArgs e) {
            // Remove the data item from the database.
            Northwind.Remove(e.DataItem);
            await Northwind.SaveChangesAsync();
            // Reload the entire Grid.
            Data = await Northwind.Employees.ToListAsync();
        }
    
        public void Dispose() {
            Northwind?.Dispose();
        }
    }
    

    Implements

    See Also