Hi,
I'm trying the below code to populate a Radzen Drop Down List, using the code below, but when it renders the drop down list displays only:
'System.Linq.Enumerable+WhereListIterator`1[Radzen_Testing2025.Components.Pages.Testing+Role]'
Where am I going wrong please?
page "/Testing"
@using Radzen;
@using Radzen.Blazor;
@using System.Diagnostics;
<h3>Testing</h3>
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Gap="0.5rem" class="rz-p-sm-12">
<RadzenDropDown AllowClear="true" AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" @bind-Value=@(employee.Roles) Multiple="true" Placeholder="Select..." Data=@roles Style="width:400px" />
</RadzenStack>
@code {
class Employee
{
public IEnumerable<Role> Roles { get; set; }
}
class Role
{
public int Id { get; set; }
public string Name { get; set; }
}
Employee employee;
IEnumerable<Role> roles;
protected override void OnInitialized()
{
roles = new List<Role>()
{
new Role {Id = 1, Name="Role1"}
,
new Role {Id = 2, Name="Role2"}
};
employee = new Employee();
employee.Roles = roles.Where(r => r.Id == 1);
}
}