Hello everyone.
I have the following server-side Blazor application with 2 pages with 2 grids from 2 different tables in a database.
Every row in the table has an edit button which executes a RadzenDialog and in every radzen page I have on method OnInitialized the delegates for Open and Close for the dialog like this:
The problem is:
When I go to page 2, do nothing or do an edit, and then go to page 1, insead of the methods from page 1, are executed the methods from page 2 and I've noticed when I go for a third time on the second page the events are fired twice!
Also you may not need to use OnOpen and OnClose altogether. The OpenAsync method of the dialog service returns the result used when the dialog service is closed.
var result = await DialogService.OpenAsync<MyDialog>();
and then in MyDialog.razor
var dialogResult = true;
DialogService.Close(dialogResult);
Declare a parameter of type EventCallback in the component that is opened as a dialog. Upon opening the dialog with DialogService.Open... pass aprropriate callback as an argument for this parameter.