Hi,
I'm trying to set the preselected values from another table for the multiselect dropdown.
But I'm getting and object reference error.Is there any Solution to preselect items in the dropdown ?
< <RadzenDropDown Multiple="true" Placeholder="Select..." Data="@bosDistrictslist" TextProperty="DistrictName" ValueProperty="Id"
Style="margin-bottom: 20px; width:200px;" @bind-Value="@selecteddistrictids" Change="@(args => Change(args, "DropDown with multiple selection"))"
@bind-SelectedItem="@_selectedItem">
...
IEnumerable bosDistrictslist;
object selecteddistrictids;
object selectedbosDistricts;
object _selectedItem;
protected override async Task OnInitAsync()
{
BosBoardMotionsList = await DataService.GetBosBoardMotionsAsync();
// Get districts list
bosDistrictslist = await DataService.GetBosDistrictsAsync();
// Get board members list
bosMemberslist = await DataService.GetBosmembersAsync();
selectedbosDistricts = (from dist in bosDistrictslist
where dist.Id == 1
select dist);
_selectedItem = selectedbosDistricts;
}
void Change(object value, string name)
{
events.Add(DateTime.Now, $"{name} value changed to {string.Join(",", ((IEnumerable)CustomerIDs))}");
}
Thanks,
Fatima