Skip to main content
All docs
V25.2
  • GridCommandColumnDisplayMode Enum

    Lists command column display modes.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    Declaration

    public enum GridCommandColumnDisplayMode

    Members

    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

    Related API Members

    The following properties accept/return GridCommandColumnDisplayMode values:

    Remarks

    The Grid component displays command column actions as icons. Specify DisplayMode to replace icons with captions or display both:

    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();
        }
    }
    
    See Also