Dropdown Filtering not working after Change event

If have the two dropdowns below.

Filtering on the first one works great.

The data for the second one is populated on Change which works great as far as populating the data BUT even though the data is correct in the dropdown, filtering does not work.

Appreciate any guidance.

    <RadzenRow style="margin-bottom: 1rem">
        <RadzenColumn SizeMD="3">
            <RadzenLabel Text="Carrier" Component="Carrier" style="width: 100%" />
        </RadzenColumn>
        <RadzenColumn SizeMD="9">
            <RadzenDropDown AllowFiltering="true" FilterOperator="StringFilterOperator.Contains" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                            Data="@carriersForCarrierId" TextProperty="Name" ValueProperty="Id" AllowClear=true Disabled="@disableCarrierDropDown"
                            Placeholder="Choose Carrier" style="display: block; width: 100%" @bind-Value="@load.CarrierId"
                            Name="CarrierId" Change=@(args => OnCarrierChange(load)) />
        </RadzenColumn>
    </RadzenRow>
    <RadzenRow style="margin-bottom: 1rem">
        <RadzenColumn SizeMD="3">
            <RadzenLabel Text="Driver" Component="Driver" style="width: 100%" />
        </RadzenColumn>
        <RadzenColumn SizeMD="9">
            <RadzenDropDown AllowFiltering="true" FilterOperator="StringFilterOperator.Contains" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                            Data="@driversForDriverId" ValueProperty="Id" AllowClear=true Disabled="@disableDriverDropDown"
                            Placeholder="Choose Driver" style="display: block; width: 100%" @bind-Value="@load.DriverId"
                            Name="DriverId" Change=@(args => OnDriverChange(load))>
                <Template Context="FullName">
                    @($"{FullName.FirstName} {FullName.LastName}")
                </Template>
            </RadzenDropDown>
        </RadzenColumn>
    </RadzenRow>

    protected async Task OnCarrierChange(Load load)
    {
        disableDriverDropDown = false;
        driversForDriverId = await sql_databaseService.GetDrivers(new Query
        {
            Filter = $@"i => i.TenantId==" + Security.Tenant.Id + $@" && i.CarrierId==" + load.CarrierId
        });
        driversForDriverId = driversForDriverId.OrderBy(x => x.FirstName);
        load.TruckId = null;
        truckNameNum = null;
        load.DriverId = null;
    }

DropDown filtering works with TextProperty - it’s not defined for your second DropDown.

makes sense, thank you.

is there a way to define TextProperty as a concatenation of two properties?

You can see I'm using a template to concatenate FirstName and LastName, I need to be able to filter by that combined string.

Such definition is possible only if you extend your data item with additional property or you can use LoadData event to implement your own custom filtering:

1 Like