Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxListEditorBase<TData, TValue>.TextFieldName Property

Specifies the data source field that contains text for component items.

Namespace: DevExpress.Blazor.Base

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

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

#Property Value

Type Default Description
String String.Empty

A string value that specifies a data source field’s name.

#Remarks

Use the TextFieldName property when you bind a list editor (ComboBox, List Box, TagBox) to a data source that store custom objects (IEnumerable<CustomType>). This property specifies the name of the data source field that stores text for component items.

If the TextFieldName property is not specified, the editor searches for a Text field in the data source and uses this field as a text field. Otherwise, the editor populates its items with the CustomType.ToString() values.

#ComboBox

@using BlazorApp.Data

<DxComboBox Data="@Staff.DataSource"
            @bind-Value="@SelectedPerson"
            TextFieldName="TextField"
            DropDownWidthMode="DropDownWidthMode.EditorWidth"
            AllowUserInput="true">
</DxComboBox>

@code {
    Person SelectedPerson { get; set; } = Staff.DataSource[0];
}

ComboBox CustomObject

Run Demo: ComboBox - Overview

Watch Video: ComboBox Getting Started – Bind to Data

#List Box

@using BlazorApp.Data

<DxListBox Data="@Staff.DataSource"
          @bind-Values="@Values"
          TextFieldName="FirstName">
</DxListBox>

@code {
    IEnumerable<Person> Values { get; set; } = Staff.DataSource.Take(2);
}

ComboBox Editor Width

Run Demo: List Box - Overview

Note

The TextFieldName property is not in effect if you specify the ItemDisplayTemplate or the ColumnCellDisplayTemplate property, or when you add columns to the List Box.

#TagBox

@using BlazorApp.Data

<DxTagBox Data="@Staff.DataSource"
          @bind-Values="@SelectedStaff"
          TextFieldName="TextField"
          DropDownWidthMode="DropDownWidthMode.EditorWidth">
</DxTagBox>

@code {
    IEnumerable<Person> SelectedStaff { get; set;} = new List<Person>() { Staff.DataSource[0] };
}

Run Demo: TagBox – Drop-Down List Width

#Implements

DevExpress.Blazor.IListEditorBase<TData, TValue>.TextFieldName
See Also