Blazor Dropdown Multiple Select Model - creates unhandled exception when selecting items

I'm new to Blazor and I want to use the Multiple Select Dropdown - I can get the dropdown to load but as soon as I select an item I get " An unhandled exception has occurred. See browser dev tools for details." message
Detailed:
System.InvalidCastException: Unable to cast object of type 'System.Linq.EnumerableQuery1[System.Nullable1[System.Int32]]' to type 'System.Collections.Generic.IEnumerable1[System.String]'. at Radzen.DropDownBase1.SelectItem(Object item, Boolean raiseChange)
at Radzen.Blazor.RadzenDropDown`1.OnSelectItem(Object item)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

I've tried setting the TValue but still having issues.

Control:
<RadzenDropDown TValue="IEnumerable" Multiple="true" Placeholder="Select..." Data="@DealerList" TextProperty="Dealername" ValueProperty="Dealerid" Change="@(args => Change(args, "DropDown with multiple selection"))" />

Model: ViewDealers
namespace web_pineview.Models
{
public class ViewDealerList
{
public ViewDealerList[] ViewDealer { get; set; }
}
public class ViewDealer
{
public int? Dealerid { get; set; }
public string Dealername { get; set; }
}
}

Added @bind-Value: <RadzenDropDown TValue="IEnumerable" Multiple="true" Placeholder="Select..." @bind-Value="multipleValues" Data="@DealerList" TextProperty="Dealername" ValueProperty="Dealerid" Change="@(args => Change(args, "DropDown with multiple selection"))" />

no difference

Should be IEnumerable<YourValuePropertyType>

If I change to IEnumerable or just int - which matches the value type - I get the compile error: Severity Code Description Project File Line Suppression State
Error CS1662 Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type web_pineview C:\Pineview\PineviewERPDevelopmentRepo\web_pineview\obj\Debug\netcoreapp3.1\Razor\Pages\Index.razor.g.cs 234 Active

You cannot bind multiple int values to an int property.

OK - I couple of things and still same results

  1. I did change the value to dealername which is a string to: <RadzenDropDown TValue="IEnumerable " Multiple="true" Placeholder="Select..." @bind-Value="multipleValues" Data="@Dealers" TextProperty="Dealername" ValueProperty="Dealerid" Change="@(args => Change(args, "DropDown with multiple selection"))" />
  • same result - control loads but as soon as I click on an item > An unhandled exception has occurred. See browser dev tools for details

Wrong pasted - <RadzenDropDown TValue="IEnumerable ''" Multiple="true" Placeholder="Select..." @bind-Value="multipleValues" Data="@Dealers" TextProperty="Dealername" ValueProperty="Dealername" Change="@(args => Change(args, "DropDown with multiple selection"))" />

Ok - I did a clean and rebuild and it works if I use the text value (dealername) - the issue is I need the dealerid which is an int - its an int in the database and model - do you know how I might cast or convert so the value is an int?

Again, the property multipleValues should be IEnumerable of your ValueProperty type. If the ValueProperty is int you will need to declare multipleValues to be IEnumerable<int>:

IEnumerable<int> multipleValues;

I appreciate your patience - the same issue - anyway I try it with an int as the value - I get the runtime issue - it works when its a string

Control: (dealerid is an int)
<RadzenDropDown TValue="IEnumerable< int >" Multiple="true" Placeholder="Select..." @bind-Value="multipleValues" Data="@Dealers" TextProperty="Dealername" ValueProperty="Dealerid" Change="@(args => Change(args, "DropDown with multiple selection"))" />

Code:
IEnumerable< int > multipleValues;
void Change(object value, string name)
{
var str = value is IEnumerable ? string.Join(", ", (IEnumerable)value) : value;

    StateHasChanged();
}

@ty.brown, this forum supports markdown. Please format your code snippets by wrapping them inside ``` blocks.

POSTED CODE FORMATED
*I'm calling a PostGreSQL VIEW via API CORE 3.1 Entity Frame Work - Has not Key

  • Blazor to Class to API

MODEL:
namespace web_pineview.Models
{
public class ViewDealerList
{
public ViewDealerList[] ViewDealer { get; set; }
}
public class ViewDealer
{
public int? Dealerid { get; set; }
public string Dealername { get; set; }
}
}

CONTROL:
<RadzenDropDown TValue="IEnumerable<int>" Multiple="true" Placeholder="Select..." @bind-Value="multipleValues" Data="@Dealers" TextProperty="Dealername" ValueProperty="Dealerid" Change="@(args => Change(args, "DropDown with multiple selection"))" />

CODE:
IEnumerable<ViewDealer> Dealers;
IEnumerable<int> multipleValues;

protected override async Task OnInitializedAsync()
    {
        var client = _clientFactory.CreateClient("ExternalAPIPVB");
        var user = (await authenticationStateTask).User;

        try
        {
            Dealers = await _APIPineviewService.GetViewDealerAsync(user.Identity.Name);
            errorString = null;
        }
        catch (Exception ex)
        {
            errorString = $"There was an error getting data from API: { ex.Message }";
        }
    }


void Change(object value, string name)
        {
            var str = value is IEnumerable<object> ? string.Join(", ", (IEnumerable<object>)value) : value;

            StateHasChanged();
        }

I have continued to try and resolve with no real resolve, I have tried different controls and found the RadzenDropDownDatagrid with multiple select works as expected, however, the RadzenListbox control with multiple select has the same issue.

<RadzenListBox AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                                           @bind-Value="multipleValues" Multiple="true"
                                           Data="@Dealers" TextProperty="Dealername" ValueProperty="Dealerid"
                                           Change="@(args => Change(args, "ListBox with multiple selection"))" Style="Width:400px;height:200px;" />

We will need a complete example which reproduces the problem.