Search⌘ K
AI Features

Adding a Route Parameter

Explore how to add route parameters to Blazor WebAssembly Razor components to enable dynamic URL handling. Understand using multiple @page directives, how to test route parameters through URL changes, and navigate programmatically with NavigationManager. This lesson equips you to build responsive routes that respond to user inputs and URL variations.

We'll cover the following...

Components can have multiple @page directives. We will add an @page directive to the Counter component that uses a parameter. We do this as follows:

  1. Return to Visual Studio.
  2. Open the Pages\Counter.razor file.
  3. Add the following @page directive to the
...