Declined
Last Updated: 03 Dec 2020 12:51 by ADMIN
Dave
Created on: 03 Dec 2020 08:15
Category: Grid
Type: Bug Report
0
TelerikGrid Create/Update/Delete events fire after Read (CRUD)

I'm using the OnRead / OnCreate / OnUpdate / OnDelete events of the TelerikGrid. Most examples do not use OnRead to load data, instead using OnInitializedAsync().

When performing an update two events will fire, such as OnCreate and then OnRead to reload the grid data - which makes sense. The problem is OnRead is not awaited, so in effect the Read method can reload the data prior to data being updated on the server. This is especially the case if I have a JavaScript delete confirmation prompt.

What's my best way forward? Not use OnRead and use OnInitializedAsync instead? Somehow trigger OnRead again (which would effectively trigger it twice)?

Thanks,

Dave

 

2 comments
ADMIN
Marin Bratanov
Posted on: 03 Dec 2020 12:51

Hello Dave,

Indeed, the CUD methods (OnRead too, by the way), should be async Task and not async void. We've added that information in the Editing Overview article Notes section. You may find the rest of the tips there useful too.

At some point perhaps there will be an example that uses a bigger database to perform the CRUD operations and that would also include the usage of OnRead, for the time being you can find more details on using it here and here.

With that said, I am marking this bug report as "Declined" because it is not an issue in the component, bur rather a framework behavior.

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Dave
Posted on: 03 Dec 2020 08:22

To answer my own question my issues was the CUD methods were async void and not async Task.

But it might be worth having an example with OnRead/OnCreate/OnUpdate/OnDelete instead of OnInitializedAsync?

 

Thanks - great controls.