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

Blazor 8 Server - @Onclick not triggering the function in code even with rendermode = InteractiveServer

$
0
0

I have this component :

@using Models@using Microsoft.AspNetCore.Identity@inject SignInManager<AccountUser> SignInManager@inject NavigationManager Navigation@rendermode InteractiveServer<div class="d-flex flex-column flex-shrink-0 p-3 bg-light " style="width: 260px;overflow: auto;"><a href="/" class="text-decoration-none"><div><img src="images/logo.png" style="width:200px;" /></div></a><hr /><button class="btn btn-link align-items-center link-dark text-decoration-none" @onclick="LogoutUser" style="padding: 0; border: none; background: none;"><i class="bi bi-door-closed"></i> &nbsp;Logout</button></div>@code {    private async Task LogoutUser()    {        await SignInManager.SignOutAsync();        Navigation.NavigateTo("/login", true);    }}

When I'm clicking on the Logout button , nothing happens, the private async Task LogoutUser() is not triggered.

I tried to add @rendermode InteractiveServer, same issue.

When I'm using "<Routes @rendermode="InteractiveServer" />" in App.razor :

I got this error message :

InvalidOperationException: There is already a subscriber to thecontent with the given section ID 'System.Object'.Microsoft.AspNetCore.Components.Sections.SectionRegistry.Subscribe(objectidentifier, SectionOutlet subscriber)

I tried many solutions related to this kind of issue that I found in stackoverflow, but nothing works for me.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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