How can I perform programmatic routing without a URL change?

Platform: Blazor| Category : Routing, Tips and Tricks

You can perform routing without changing the URL with the help of NavigationManager. You need to inject NavigationManager to use this service. You can use this service to perform routing programmatically.

Service Injection

@inject NavigationManager Navigate

<button @onclick="NavigateTo">Navigate</button>

@code {

      private void NavigateTo(){
             Navigate.NavigateTo("url");//specify required url here
      }
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.