Pressing delete on RadzenDropDown Filtered text causes exception

I am using nuget package 3.1.0

I have a RadzenDropDown that has AllowFiltering set to true.
I type in a filter and select an item from the drop down. That works fine.
If I use the backspace to clear out/change the filter, that works fine as well.
However, if instead, I use the delete key to clear out/change the filter (i.e. have a part of the filter text highlighted and hit the delete key), I get the following exception:

Unhandled exception rendering component: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Radzen.DropDownBase1.<SelectItem>d__65[[System.Int32, System.Private.CoreLib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at Radzen.Blazor.RadzenDropDown1.d__14[[System.Int32, System.Private.CoreLib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Radzen.DropDownBase1.<HandleKeyPress>d__47[[System.Int32, System.Private.CoreLib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext() at Radzen.DropDownBase1.d__48[[System.Int32, System.Private.CoreLib, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

This only seems to occur if there was a previous filter selected. I have not been able to get it to happen if the drop down is currently blank.

Please let me know if there is anything more I should provide with this.


I was not able to reproduce the problem on our demo:

Thank you for the quick reply, enchev!

I did some more tinkering around and I have a bit more information.

Using the exact same setup as the demo, I also do not receive the error.

What I found to be the difference is that my @bind-Value is set to an int instead of a string. Is this not allowed? The ValueProperty is an integer as well, for what it is worth.

Interestingly enough, if you have something selected and you press the delete key (even if some of the text is still present for your filter), it triggers null to be passed to the Change function as the arguments (even though the selected item from the drop down has not been selected by the user here, just the filter text).

My hypothesis is that it is trying to do a conversion from null to int and failing (prior to the Change method).
Also of note, when pressing the backspace or any normal letters for typing in a filter, this event is not triggered.
The arrow keys (left/right/up/down) also seem to trigger this, I've noticed, as the Change event also gets fired at this point in time.

Below is the output of my debugging. The first "Passed args 1146" was me actually making a selection in the drop down. All subsequent "Passed args" messages are either the delete key or arrow keys being pressed. At no point did I actually select a different item from the drop down. Letters and/or backspaces did not trigger these messages. Is this expected behavior? I can change this to be a string or a nullable int to get around it, but I am now concerned about the Change method being called more often than intended as this will cause a lot of web service calls when the user has not made a selection change.

Please let me know if any of this doesn't make sense or if I am doing something wrong.


EDIT: I did notice that the arrow keys are actually changing the selected item in the drop down, so I am guessing that is expected behavior. Is there a way of turning off the arrow keys/delete key when actually typing in the autofilter area (the area w/ the magnifying glass)?

Because I am worried my previous reply may not have made much sense, I am going to put some sample code here:

<RadzenDropDown @bind-Value="@TestId" AllowFiltering="true" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" Placeholder="Select..." Data="@MyData" TextProperty="Name" ValueProperty="Id" Change="@(args => TestOnChange(args))" Style="width:400px">

int? TestId {get; set;} // --> This will work (as will a string or a nullable type)
//int TestId {get; set;} // --> This will cause the error I first posted

void TestOnChange(object args)
//Do something w/ args

Were you able to reproduce the error I am experiencing with the added detail?

For now, I am just going to use a nullable int (bandaids the delete key issue for the time being). I do still have concerns about the arrow keys causing postbacks, so if I can prevent those from actually changing the selected record until the user hits enter or clicks the mouse, that would be great.

Thanks again,

Hey @tcsmith,

If you have Radzen subscription you can send us your application to to check what’s going on.

Hello @enchev,

I do not have a subscription, yet. I just installed the nuget package on Friday in an attempt to see if it will fulfill our needs. I figured alerting a found bug would be beneficial to all.