DropdownList, OnRead, Grouping

1 Answer 4 Views
DropDownList
Hans
Top achievements
Rank 1
Hans asked on 29 Oct 2025, 02:34 PM

Hi there

 

I'm trying to use DropDownlist with the Grouping field and the OnReadEvent, with mode = DropDownScrollMode.Scrollable

The OnRead event provides the grouping field to the request. The request is sent to my (API) server that handles the request, and the result is returned . Then after my OnReadHandler method ands, I get an internal exception: "System.NullReferenceException: 'Object reference not set to an instance of an object.'"

with following stack:

 

 	Telerik.Blazor.dll!Telerik.Blazor.Components.Common.TelerikSelectBase<SNG.LccNion.API.Model.Dto.IDDescriptiveDto, string>.ProcessGroupData(System.Collections.IEnumerable data)	Unknown
 	Telerik.Blazor.dll!Telerik.Blazor.Components.Common.TelerikSelectBase<SNG.LccNion.API.Model.Dto.IDDescriptiveDto, string>.SetProcessedData(System.Collections.IEnumerable data)	Unknown
 	Telerik.Blazor.dll!Telerik.Blazor.Components.TelerikDropDownList<SNG.LccNion.API.Model.Dto.IDDescriptiveDto, string>.SetProcessedData(System.Collections.IEnumerable data)	Unknown
 	Telerik.Blazor.dll!Telerik.Blazor.Components.Common.DataBoundComponent<SNG.LccNion.API.Model.Dto.IDDescriptiveDto>.ProcessOnReadResult(Telerik.Blazor.Components.ReadEventArgs args)	Unknown
 	Telerik.Blazor.dll!Telerik.Blazor.Components.Common.TelerikSelectBase<SNG.LccNion.API.Model.Dto.IDDescriptiveDto, string>.ProcessOnReadResult(Telerik.Blazor.Components.ReadEventArgs args)	Unknown
 	Telerik.Blazor.dll!Telerik.Blazor.Components.Common.DataBoundComponent<SNG.LccNion.API.Model.Dto.IDDescriptiveDto>.ProcessOnReadData()	Unknown
 	[Resuming Async Method]	
>	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Telerik.Blazor.Components.Common.DataBoundComponent<SNG.LccNion.API.Model.Dto.IDDescriptiveDto>.<ProcessOnReadData>d__39>.ExecutionContextCallback(object s) Line 292	C#
 	System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 179	C#
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Telerik.Blazor.Components.Common.DataBoundComponent<SNG.LccNion.API.Model.Dto.IDDescriptiveDto>.<ProcessOnReadData>d__39>.MoveNext(System.Threading.Thread threadPoolThread) Line 372	C#
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.AsyncStateMachineBox<Telerik.Blazor.Components.Common.DataBoundComponent<System.__Canon>.<ProcessOnReadData>d__39>.MoveNext() Line 350	C#
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__12_0(System.Action innerContinuation, System.Threading.Tasks.Task innerTask) Line 281	C#
 	System.Private.CoreLib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunCallback(System.Threading.ContextCallback callback, object state, ref System.Threading.Tasks.Task currentTask) Line 697	C#
 	System.Private.CoreLib.dll!System.Threading.Tasks.Task.RunContinuations(object continuationObject) Line 3486	C#
 	System.Private.CoreLib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<Telerik.Blazor.Components.ReadEventArgs>.SetResult(Telerik.Blazor.Components.ReadEventArgs result) Line 478	C#
 	[Completed] Telerik.Blazor.dll!Telerik.Blazor.Components.TelerikDropDownList<SNG.LccNion.API.Model.Dto.IDDescriptiveDto, string>.TriggerReadAsync(Telerik.DataSource.DataSourceRequest request)	Unknown

I am struggling to handle the request correctly and provide an answer back to the list that it can handle properly.

Nevertheless I get errors. Is there a working example of using the OnRead event with the GroupField property set to a property of the TItem? Or is this combination impossible inspite of DropDownScrollMode.Scrollable mode?

BTW - In case of large dropdownlist result set I want to fall back to virtual mode, and drop the grouping option, as it is documented that these are not compatible. (This is handled blazor side by checking the dataset count before the first OnRead call)

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 30 Oct 2025, 08:25 AM

Hi Hans,

See this example that shows a DropDownList set up with a GroupField and OnRead event: https://blazorrepl.telerik.com/cpFYnauW19Q4JT8j38 

Note that in the OnRead event, the data (in this case a List<Employee>) is converted to DataSourceResult. This ensures that it is in the format the DropDownList expects it. 

Regards,
Ivan Danchev
Progress Telerik

Your perspective matters! Join other professionals in the State of Designer-Developer Collaboration 2025: Workflows, Trends and AI survey to share how AI and new workflows are impacting collaboration, and be among the first to see the key findings.
Start the 2025 Survey
Tags
DropDownList
Asked by
Hans
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or