Blazor Forms Calculator that takes inputs and calculates numbers. At the end I have two buttons, Download PDF (with the results) and New Calculation that will restart the application.
JavaScript
x
7
1
<button @onclick=Print style="background-color:green;">
2
Download PDF
3
</button>
4
<button style="background-color:green;">
5
New Calculation
6
</button>
7
Can I do that with the @onclick event or call a Javascript function?
Advertisement
Answer
I have used Navigation Manager and have navigated the app on the Index page
JavaScript
1
5
1
private void HandleClick()
2
{
3
NavigationManager.NavigateTo("/", true);
4
}
5
calling it on click
JavaScript
1
5
1
<button @onclick=HandleClick style="background-color:green;" class="btn btn-
2
primary btn-medium hidewhenprint">
3
New Calculation
4
</button>
5