Skip to main content
All docs
V25.1
  • DxTreeList.SearchTextChanged Event

    Fires when the search text changes.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [Parameter]
    public EventCallback<string> SearchTextChanged { get; set; }

    Parameters

    Type Description
    String

    A new value of the SearchText property.

    Remarks

    The SearchTextChanged event fires each time the SearchText property value changes. The event is handled automatically when you use two-way data binding for the SearchText property (@bind-SearchText).

    Handle this event to create a custom response to search text changes:

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList Data="TreeListData"
                KeyFieldName="Id"
                ParentKeyFieldName="ParentId"
                ShowSearchBox="true"
                SearchText="@searchText"
                SearchTextChanged="OnSearchTextChanged">
        <Columns>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    <text>@SearchTextInfo</text>
    
    @code {
        List<EmployeeTask> TreeListData { get; set; }
        string searchText { get; set; }
        string SearchTextInfo { get; set; }
    
        void OnSearchTextChanged(string newSearchText) {
            SearchTextInfo = "The current search text is: " + newSearchText;
        }
        protected override void OnInitialized() {
            TreeListData = EmployeeTaskService.GenerateData();
        }
    }
    

    TreeList Search Info

    Refer to the following topic for additional information: Search Box in Blazor TreeList.

    See Also