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

Blazor MainLayout as a CascadingParameter always null

$
0
0

so...Im working on a Blazor Server app and having troubles with anderstanding of how a cascading parameters work and why my MainLayout returns always null.

Im doing it like this:MainLayout.razor:

<CascadingValue Value="this"><PageTitle>Global</PageTitle><div id="wrapper"><SfToolbar CssClass="dockToolbar"><ToolbarEvents Clicked="@Toggle"></ToolbarEvents><ToolbarItems><ToolbarItem PrefixIcon="e-icons e-menu" TooltipText="Menu"></ToolbarItem><ToolbarItem><Template><div class="e-folder"><div class="e-folder-name">Global</div></div></Template></ToolbarItem></ToolbarItems></SfToolbar><div id="main-content container-fluid col-md-12" class="maincontent"><div><div class="content">@Body</div></div></div></div>

and Pages that behaves

SignIn.razor:

@page "/sign-in"<ComponentLibrary.Components.AuthPage backUrl="/"></ComponentLibrary.Components.AuthPage>@code {    [CascadingParameter]    public MainLayout? Layout { get; set; }    protected override void OnInitialized()    {        Layout.userModel = null;        Layout.RefreshSideBar();        base.OnInitialized();    }}

But when im getting on SignIn page my Layout for some reason is null, any advices where need to look at?

i tried to just create a new example of Layout in other pages but that is tottaly not what i needed


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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