Dropdown List Not Pinning Selection

Hi There!

I'm using Radzen Blazor 2.11.8 and cannot sort out why when a user selects an item from the dropdown list, the text selection shown is the first item in the list. The dropdown list is populating correctly and there are no errors. I've also confirmed the value is changing using a RadzenCard in a similar fashion to the example.

The data is populated from a REST API.

<RadzenDropDown AllowClear="true" AllowFiltering="true"
Data="@chargeCodes"
@bind-Value="chargeCode.Id"
TextProperty="Label"
ValueProperty="Id"
Style="margin-bottom: 5px; width:250px;"
Change="@(args => ChangeBound(args, "Not yet implemented"))" />

Not sure how RadzenCard is related - this component is just a container. What is the collection used to populate the DropDown? More info about the item will be helpful as well.

I just figured it out...it was related to some debugging code left in the project. To close the loop on this thread, here's a more complete picture.


I used the RadzenCard to display the selected value on the change event to confirm the selected value is correct. I was just noting the selected value is working, just the display in the dropdown keeps
reverting to the first item.

To confirm, the dropdown list is populating with the correct values and text. The filtering and clearing features work well. When a user selects an item from the dropdown, the selected value changes but the text pegs to the first item in the list.

            <div class="align-middle">
                <RadzenDropDown AllowClear="true" AllowFiltering="true"  
                                Data="@chargeCodes"
                                @bind-Value="chargeCode.Id"
                                TextProperty="Label"
                                ValueProperty="Id"
                                Style="margin-bottom: 5px; width:250px;"
                                Change="@(args => ChangeBound(args, "Not yet implemented"))" />
            </div>

@code {
protected RemotePickListItemDto[] chargeCodes = Array.Empty();
protected RemotePickListItemDto chargeCode = new RemotePickListItemDto { Label = "Loading..." };

protected override async Task OnInitializedAsync()
{
    await LoadChargeCodes(null);
    chargeCode = chargeCodes[0]; // THIS IS WHAT WAS SETTING THE ITEM TO THE FIRST ITEM
}
private async Task LoadChargeCodes(LoadDataArgs? args)
{
    try
    {
        var chargeCodesResponse = await Http.GetAsync($"{URI}"); 
        var rcjson = await chargeCodesResponse.Content.ReadAsStringAsync();
        chargeCodes = JsonConvert.DeserializeObject<RemotePickListItemDto[]>(rcjson);
    }
    catch (Exception e)
    {
        error = e.Message;
    }
}
void ChangeBound(object value, string name)
{
}

}