How to trigger OnLoad on other page after DialogClose

Hello,

I have edit page (as master), that enabled us to add child details. After successful child insert and then the dialog is close, how to trigger OnLoad at master so I can recalculate the summary.

Below is the edit page as master:

Below is child insert dialog:

After successful insert, the dialog will close. How to trigger onload at master side so I can recalculate all the summary:

Thank you,
Ismail

You can use execute action with await Load() as code.

Hi @enchev,

Thank you for your feedback. Try your suggestion by execute await Load() on Form0Submit() of the Children, but did not Load the master after the children dialog is close. Maybe I wrongly put the code, do you have any idea the best place to put the await Load() code? so it can hit the Load master?*
*note: I'm planning to put my recalculation code at that Load master.

this is where I put the await Load(); at child dialog, but it did not work to load the master.

    protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.InvoiceLine args)
    {
        try
        {
            var simpleInvoiceCreateInvoiceLineResult = await SimpleInvoice.CreateInvoiceLine(invoiceline);
            DialogService.Close(invoiceline);

            await Load();
        }
        catch (System.Exception simpleInvoiceCreateInvoiceLineException)
        {
            NotificationService.Notify(new NotificationMessage(){ Severity = NotificationSeverity.Error,Summary = $"Error",Detail = $"Unable to create new InvoiceLine!" });
        }
    }

Best regards,
Ismail

Check how the master data are retrieved. If the master DataGrid is bound using LoadData you will need to execute Reload() for the master DataGrid.

Hello @enchev,

Thank you for your feedback. Your answer give me an idea. after added await grid0.reload(); and added method for header summary recalculation, after that, the scenario what I want to achieve is achieved.

Below is the final code that I use:

   protected async System.Threading.Tasks.Task BtnAddClick(MouseEventArgs args)
    {
        var dialogResult = await DialogService.OpenAsync<AddInvoiceLine>("Add Invoice Line", new Dictionary<string, object>() { {"InvoiceId", InvoiceId} }, new DialogOptions(){ Width = $"{700}px" });
        await grid0.Reload();

        await RecalculateSummary(invoice,InvoiceLines);
    }

Which I put at add new item button that opened the dialog for inserting child item detail:

Now, each time new item inserted, the grid refresh with new data and the total summary successfully recalculated.

Thank you for your help @enchev

Best regards,
Ismail