What's the best way to navigate to a different page using Blazor? We'll call the AlterBy method from two buttons, one to increment the CurrentCount and one to decrement it. and remove the links to those pages inside the NavMenu.razor file. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. This directive, for example, assigns the component to the route "/customers": As with attribute-based routing, you can include parameters in your routes. For example, the URL https://localhost.com:5001/example/some.thing is interpreted by the router as a request for a file named some.thing. This article will point out some of the common mistakes that can happen. In addition, we can use the onclick with a parameter, as the call method is expecting a Note reference as well as the event arguments. I was unable to detect any difference, but that may reflect my general cluelessness when it comes to CSS. E-mail us. In App.razor: razor Copy <FocusOnNavigate RouteData="@routeData" Selector="h1" /> The framework throws an error for unsupported types. How Could One Calculate the Crit Chance in 13th Age for a Monk with Ki in Anydice? The action attribute specifies the path to which the URL will be redirected once the form is submitted. If you also want to open a new tab, you need an anchor element () and to set its target attribute to _blank. If the answer doesnt solve your issue, please provide more details of error that will help us track down whats happening. In the following example, Id is required, but Option is an optional boolean route parameter. The Blazor Button provides a variety of styling options through the built-in themes and the button type. In the preceding example, the Home NavLink href="" matches the home URL and only receives the active CSS class at the app's default base path URL (for example, https://localhost:5001/). Next, we need to set our ClassName property to the class attribute. Finally, we will demonstrate how to set up a Blazor async event handler, very important if the application is making API calls. When a request is made for /route-parameter-1/amazing, the