Skip to content

Instantly share code, notes, and snippets.

@felipeabajo
Created November 16, 2023 12:39
Show Gist options
  • Save felipeabajo/5941a90622aae48e35cb5d38d2a97547 to your computer and use it in GitHub Desktop.
Save felipeabajo/5941a90622aae48e35cb5d38d2a97547 to your computer and use it in GitHub Desktop.
Snippets for navigation in Blazor using SyncFusion
/*NAVIGATION BETWEEN PAGES*/
/*Navigation to Razor pages from SyncFussion buttons*/
@inject NavigationManager NavigationManager
<SfButton Content="To CsHtml page from Sf Button" OnClick="@(() = NavigateToRazorPage("/REPLACEWITHCSHTMLPAGE"))"></SfButton>
@code{
async Task NavigateToRazorPage(string page) {
NavigationManager.NavigateTo(page);
}
}
/*Workaround for navigation to CsHtml pages from SyncFussion buttons*/
@inject IJSRuntime JSRuntime
<SfButton Content="To CsHtml page from Sf Button" OnClick="@(() = NavigateToCsHtmlPage("/REPLACEWITHCSHTMLPAGE"))"></SfButton>
@code{
async Task NavigateToCsHtmlPage(string page) {
await JSRuntime.InvokeAsync<object>("open",page,"_self") //also valid with other a[target] values
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment