Radzen Dropdown - Null Reference on click or clear

I am developing an application using Blazor Server.

I have a drop-down list in my of a list of countries.

If I click on the dropdown to select an item, or click on the "X" to clear it I get the following error. If I move the dropdown outside of the edit form, it works fine. As long as I don't click on it, it works.

Why doesn't it work inside an editform?

Error: System.NullReferenceException: Object reference not set to an instance of an object.
at Radzen.Blazor.ValidatorBase.ValidateField(Object sender, FieldChangedEventArgs args)
at Microsoft.AspNetCore.Components.Forms.EditContext.NotifyFieldChanged(FieldIdentifier& fieldIdentifier)
at Radzen.DropDownBase1.SelectItem(Object item, Boolean raiseChange) at Radzen.Blazor.RadzenDropDown1.OnSelectItem(Object item, Boolean isFromKey)
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

This is the code for the dropdown:

<RadzenDropDown AllowClear="true"
TValue="string"
Name="LandlordCounty"
id="LandlordCounty"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
FilterOperator="StringFilterOperator.StartsWith"
AllowFiltering="true"
Data=@counties.ToList()
@bind-Value="landlordVm.LandlordCounty"
TextProperty="Text"
ValueProperty="Value"
style="display:block;"
class="form-control form-control-sm" />

Most probably the EditContext is null - you can check this using the debugger.

1 Like