Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to re-render a razor page after closing a dialog in blazor?

$
0
0

I have a main page Transact.razor Page. Inside my Transact Page, there is a button named Add New which will open a MudDialog (AddTransact.razor) where I can add a new transaction. If I were to close the MudDialog (Add Transact), i want to rerender the Transact Page so that the newly added transaction will reflect on the table in the Transact Page.

How do i do that?

I am using blazor server-side .Net 8. Since blazor is a single page application, I want to rerender the page because "refreshing" the page will defeat the purpose of SPA.

What I tried so far is:Transact.razor

private async Task AddNew(){    var options = new DialogOptions { ClassBackground = "my-custom-class", CloseOnEscapeKey = true, MaxWidth = MaxWidth.Medium, FullWidth = true, NoHeader = true };    var dialog = DialogService.Show<AddTransact>("Add New", options);    var result = await dialog.Result;    if (!result.Cancelled)    {        await vwTranService.GetAllVwTransactions();        StateHasChanged();    }}

somehow, it does not work


Viewing all articles
Browse latest Browse all 4839

Trending Articles