Back to Devexpress

DxSearchBox.Text Property

blazor-devexpress-dot-blazor-dot-dxsearchbox.md

latest1.8 KB
Original Source

DxSearchBox.Text Property

Specifies the text displayed in the Search Box.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

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

Property Value

TypeDescription
String

A string value that represents the text in the Text Box.

|

Remarks

Use the Text property to specify a search text or to bind the Search Box to a variable that stores the search text. To handle a text change, use the TextChanged event.

razor
<DxSearchBox Text="@Value"
             TextChanged="@OnTextChanged"
             aria-label="Search" />

<p class="cw-320 mt-3">
    Search text: <b>@Value</b>
</p>

@code {
    string Value { get; set; }
    void OnTextChanged(string newValue) {
        Value = newValue;
    }
}

Alternatively, you can implement two-way binding for the Text property :

razor
<DxSearchBox @bind-Text="@Value"
             aria-label="Search" />

<p class="demo-text cw-320 mt-3">
    Search text: <b>@Value</b>
</p>

@code {
    string Value { get; set; }
}

Each time the editor text has been changed, the TextChanged event fires automatically.

Run Demo: Search Box

See Also

DxSearchBox Class

DxSearchBox Members

DevExpress.Blazor Namespace