Skip to main content
A newer version of this page is available. .

DxComboBox<TData, TValue>.Text Property

Specifies the text displayed within the ComboBox edit box.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v20.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public string Text { get; set; }

Property Value

Type Description
String

The textual representation of the editor’s value.

Remarks

The Text property provides access to the <DxComboBox> edit box’s text. When you assign text to this property, you should also set the ComboBox’s AllowUserInput property to true.

To handle changes to the text, use the TextChanged event.

ComboBox Text

<DxComboBox Data="@Cities"
            TValue="string"
            TData="string"
            AllowUserInput="true"
            Text="@Text"
            TextChanged="@OnTextChanged">
</DxComboBox>

<DxButton Enabled="@IsEnabled">Update Text</DxButton>

@code {
    IEnumerable<string> Cities = new List<string>() {
        "London",
        "Berlin",
        "Paris",
    };

    string Text { get; set; } = "New York";
    bool IsEnabled = false;

    void OnTextChanged(string newValue) {
        Text = newValue;
        IsEnabled = newValue != "New York";
    }
}

If the value of the Text property is equal to a ComboBox drop-down window’s item, the corresponding item is automatically selected.

Run Demo: ComboBox - Allow Input

See Also