Hello,
I have blazor grid inside my custom component. I need to call InvokeAsync method on my EventCallback passed to this component. When I do that from SelectedItemsChanged event app gets crashed without any exception. I read the docs about async operations in this event (https://docs.telerik.com/blazor-ui/components/grid/selection/overview#asynchronous-operations), but don't know how to workaround this.
5 Answers, 1 is accepted
Hi Tomasz,
If you want to load that data on demand, you should use the OnRowClick event. The linked page contains a sample. Let me know how that works for you.
Regards,
Marin Bratanov
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

Hi Tomasz,
Technologically, this may not work. It's not that errors are thrown, but that the framework does not repaint all the content. Since the originator of the event is the grid, that's all that might be repainted in this case.
What you could do is to use a custom column where you can control the HeaderTemplate and respond to its clicks on a checkbox there in your own code. This will change the context of the event execution and you will be able to repaint the page. You can also alter the SelectedItems collection that the grid is bound to.
Regards,
Marin Bratanov
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

Hi Tomasz,
The SelectedItems is a collection of models. That's what people expect from the grid.
So, to set them, you must:
- set the SelectedItems parameter of the grid to the corresponding collection (you can use one-way or two-way binding)
- populate the collection in the view-model as desired (e.g., by extracting the models from the grid data source by the IDs you have)
Not all models have int32 IDs like that - often enough IDs for a model are GUIDs, strings, other integer types (such as long), or even other objects, which is why the grid lets you handle that according to your data.
Regards,
Marin Bratanov
Progress Telerik