Hi,
I have an object called Commission
with a Members
property which is a List of type Member. I would like to select members of a commission with a multiple select dropdown component. But I can not get it to work.
I tried to add a SelectedMemberIds
property to the Commission object with the following code so I have a property with all selected Member Ids which is filled with the current memberid's.
public bool RefreshedIds = false;
public IEnumerable<string> SelectedMemberIds
{
get
{
if (!RefreshedIds)
{
if (Members is null)
{
return Array.Empty<string>();
}
else
{
RefreshedIds = true;
SelectedMemberIds = Members.Select(m => m.Id).ToArray();
}
}
return SelectedMemberIds;
}
set
{
SelectedMemberIds = value;
}
}
This resulted in an Access violation in my code which is not really surprising because it seems like a really weird way to do this. The radzendropdown looks like this.
<RadzenDataGridColumn Width="200px" Property="MemberCount" TItem="Commission" Title="Leden">
<EditTemplate Context="commission">
<RadzenDropDown Multiple="true" AllowClear="true" ValueProperty="Id" Data="@MemberList" @bind-Value="commission.SelectedMemberIds" Name="CommissionMembers" Style="width:100%">
<Template Context="member">
@(member.FirstName) @(member.LastName)
</Template>
</RadzenDropDown>
</EditTemplate>
</RadzenDataGridColumn>
I am not sure if what I would like to do is possible with Radzen, does anybody know? Otherwise, I am just wasting time thinking about these weird structures.