Skip to main content
All docs
V23.2

DxComboBoxSettings.TextFieldName Property

Specifies the data source field that contains text for combo box items.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue("")]
[Parameter]
public string TextFieldName { get; set; }

Property Value

Type Default Description
String String.Empty

A field name.

Remarks

Specify the following settings to bind the combo box editor to data:

Data
Specifies the object that supplies combo box data.
TextFieldName
Specifies the data source field that contains text for combo box items.
ValueFieldName
Specifies the name of the data source field that contains combo box values.

The example below demonstrates how to configure DxComboBoxSettings and display values from an external collection in a Grid column:

@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory

<DxGrid Data="Products"
        EditMode="GridEditMode.EditRow">
    <Columns>
        <DxGridCommandColumn />
        <DxGridDataColumn FieldName="CategoryId" Caption="Category">
            <EditSettings>
                <DxComboBoxSettings Data="Categories"
                                    ValueFieldName="CategoryId"
                                    TextFieldName="CategoryName"/>
            </EditSettings>
        </DxGridDataColumn>
        <DxGridDataColumn FieldName="ProductName" />
        <DxGridDataColumn FieldName="UnitPrice" />
        <DxGridDataColumn FieldName="UnitsInStock" />
        <DxGridDataColumn FieldName="QuantityPerUnit" />
    </Columns>
</DxGrid>
@code {
    NorthwindContext Northwind { get; set; }
    List<Product> Products { get; set; }
    List<Category> Categories { get; set; }

    protected override async Task OnInitializedAsync() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        Products = await Northwind.Products.ToListAsync();
        Categories = await Northwind.Categories.ToListAsync();
    }

    public void Dispose() {
        Northwind?.Dispose();
    }
}

To change the field that contains text for combo box items at runtime, use the IComboBoxSettings.TextFieldName property.

Implements

See Also