When setting the binded property to null, the DropDown selections are not being cleared.
I'm displaying the binded property on the page, to show that the property itself is clearing.
<div class="col-md-6 ol-lg-4 col-xl-3 p-3">
<RadzenButton Text="Reset" Click="@Reset" />
<br />
@if (selectedGroups != null && selectedGroups.Any())
{
@foreach (var item in selectedGroups)
{
<span>@item</span>
<br />
}
}
<RadzenCard>
<h4 class="mb-4">Multiple selection</h4>
<RadzenDropDown AllowClear="true" AllowFiltering="true" @bind-Value=@selectedGroups Multiple="true" Placeholder="Select..."
Data=@groups TextProperty="GroupName" ValueProperty="GroupId" Style="width: 250px;" />
</RadzenCard>
</div>
@code {
private IEnumerable<GroupSetting> groups = new List<GroupSetting>();
private IEnumerable<string> selectedGroups = new List<string>();
protected override async Task OnInitializedAsync()
{
groups = await GroupSettingRepository.GetAllAsync();
}
private async Task Reset()
{
selectedGroups = null;
}
}