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

How to raise an event back to the mainlayout page

$
0
0

I've tried a number of ways, but none seem to work for me.

We are using Blazor Server Side with .Net 8.

part of my mainlayout.razor page looks like this:

<RadzenSidebar @bind-Expanded="@sidebarExpanded" role="navigation" aria-labelledby="sidebarmenu"><RadzenPanelMenu id="sidebarmenu"><RadzenPanelMenuItem Text="Home" Icon="home" Path="/" /></RadzenPanelMenu></RadzenSidebar><RadzenBody><div class="rz-p-4"><ErrorBoundary @ref="errorBoundary"><ChildContent><CascadingValue Value="StartSave">                    @Body</CascadingValue></ChildContent><ErrorContent><Error ErrorDetail="@context"></Error></ErrorContent></ErrorBoundary></div></RadzenBody>

The Casscading Value I have declared as:

[Parameter]public EventCallback StartSave {     get;     set; }

In my home component, I want to use this callback. The idea is that I will have a general overlay for saving across pages, so I just want to send a signla back to the main page so that it knows to start the overlay. I'll then want to send a second signal to close the overlay.

Home component has:

 [CascadingParameter] public EventCallback StartSave { get; set; }

and I call it with:

await StartSave.InvokeAsync("start");

When I hit the await the code does not go back to the parent event. What Have I done wrong?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>