A SfButton doesn't navigate like a <a> link

I have this code that generate a link and a button. The link works and the button results in triggering the <NotFound> template:

@using Syncfusion.Blazor.Buttons
@inject NavigationManager NavigationManager
 
<AuthorizeView>
    <Authorized>
        Hello, @context.User.Identity.Name!
    </Authorized>
    <NotAuthorized>
        <a rel='nofollow' href="login?redirectUri=/">Log in</a>
        <SfButton OnClick="@((args) => NavigateToLogin())" CssClass="e-warn" IconCss="fad fa-sign-in fa-fw theme-da" IconPosition=@IconPosition.Left>Login</SfButton>
    </NotAuthorized>
</AuthorizeView>
 
@code {
    private void NavigateToLogin()
    {
        NavigationManager.NavigateTo("login?redirectUri=/");
    }
}

1 Reply

SD Saranya Dhayalan Syncfusion Team May 19, 2020 06:17 AM UTC

Hi Hassan, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported issue, we are not able to reproduce it in our end in 18.1.0.52 version. Please find the below code snippet: 
 
@using Syncfusion.Blazor.Buttons 
@inject NavigationManager NavigationManager 
 
<SfButton @onclick="@((args) => NavigateToLogin())" CssClass="e-warn" IconCss="fad fa-sign-in fa-fw theme-da" IconPosition=@IconPosition.Left>Login</SfButton> 
 
 
@code { 
    private void NavigateToLogin() 
    { 
        NavigationManager.NavigateTo("/counter"); 
    } 
} 
 
Please check above code snippet if still issue persist please provide the issue reproducible sample. 
 
Regards, 
Saranya D 


Loader.
Up arrow icon