Hi,
Double-clicking on DataGrid allows to get a dialog opened where values can be changed.
How can I trigger a Load() to refresh the data when I close the Dialog window ?
Thank you
Fred
Hi,
Double-clicking on DataGrid allows to get a dialog opened where values can be changed.
How can I trigger a Load() to refresh the data when I close the Dialog window ?
Thank you
Fred
Hi @FredK_Trashmail,
Check how the DataGrid will be refreshed after Add/Edit CRUD pages with our Sample database.
Hi Enchev,
The case is not totally comparable. In the CRUD page, adding or editing happens in the same page so using the click handle is natural.
What I am trying to do is slightly different because modifications are done in dialogs. By this I mean that double-clicking a row opens a dialog which is like having moved to another page but closing the dialog when returning to the main page does not trigger a load or reload.
Thank you
Fred
Actually the CRUD pages are using dialogs by default to add and edit data.
Sorry, my mistake. I looked too fast.
I can see the
await InvokeAsync(() => { StateHasChanged(); });
as a Then of the Open Dialog handle. It does not work on my side. Quick thought is that it is because I change the opportunity from a 2nd degree dialog (double-click on app opens a dialog with info + a button which opens a dialog allowing to change the data). Then, thinking of it, it shouldn't be because the "await InvokeAsync(() => { StateHasChanged(); });" is a follow-up of the initial Open Dialog. So, still blocked.
Thank you
Fred
You can also execute Reload() for the DataGrid:
or even Load() for the page.
From the grid event handler that called the first dialog:
Now if changes are made from any child dialogs, they will result in the grid refreshing once all dialogs are closed.
This issue is exactly what I'm struggling with. Trying to refresh/reload a Radzen Datagrid on close of a dialog. Looking for the CRUD pages references but cannot find them. Can you provide a link? Thanks!
CRUD pages is template used by Radzen to create new page(s) from data:
Thank you. Actually, I'm writing this in Blazor Server (VS 2022). The dialog component is amazing and really useful for what I'm doing. Typical CRUD operation, edit a record, pull up a dialog box and click OK to save. All fine, the DB is updated. Where my problem is in refreshing the Radzen datagrid. I get a nice event at:
void Close(dynamic result)
{
console.Log($"Dialog closed");
}
This is fine for a synchronous operation without a grid and it does work fine for that. However, if I'm updating something in a Datagrid with an expensive query I need to use async await. The problem I get is that if I turn the Close into an async call:
async void Close(dynamic result)
{
await refreshGrid();
Console.WriteLine($"grid.Reload!");
}
Then I have two async calls at the same time: (1) the Update; and (2) the Refresh which causes this error:
A second operation was started on this context instance before a previous operation completed. This is usually caused by different threads concurrently using the same instance of DbContext.
This really isn't a Radzen issue directly, it only relates indirectly to a common instance of updating a record in the Radzen Dialog and then calling a refresh so the end-user has feedback on the UI of the CRUD result. I'm thinking this is far more fundamental as to handling async operations. Feeling there is a simple fix but I am in a grind at this point.
Thanks in advance!
Looks like you are using just Radzen Blazor components while this thread is for Radzen IDE.
This error might be fixed if you set MARS in your connection string:
Thank you so much....sorry for being in the IDE thread.
You can try also transient context: