In this article we will cover how to route or navigate to the specified page and force reload page in Blazor webassembly Application.
Step 1 : We need to Inject NavigationManager in our component
Step 2 : Call NavigateTo Method with specified URI and force load parameters
Example Code
using Microsoft.AspNetCore.Components; using System.Threading.Tasks; namespace HpBlogs.Pages { public partial class Demo : ComponentBase { [Inject] public NavigationManager navigationManager { get; set; } protected async override Task OnInitializedAsync() { //SIMPLE ROUTE navigationManager.NavigateTo("/aboutus"); //ROUTE AND FORSE RELOAD navigationManager.NavigateTo("/contactus", true); } } }
Post Comments(0)