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

Blazor: Reference to child page displayed by RenderFragment Body

$
0
0

If I create a Blazor project from the Visual Studio templates, in the MainLayout.razor there is a

<article class="content px-4">    @Body</article>

part. The @Body is a RenderFragment where all child pages are displayed.

If I insert a child razor page directly, I can set a reference like this:

<ChildPage @ref="child"></ChildPage>

and use this in the code to e.g. update the child page:

ChildPage child { get; set; }child.Update();

How can I get a reference to a child page in the MainLayout.razor to e.g. reload the child page?


Viewing all articles
Browse latest Browse all 4839

Trending Articles