Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How can I define a shared route parameter in Blazor to automatically use on multiple pages

$
0
0

I have a Blazor Web App (.Net8) with a lot of pages.

Is there a way to define a shared route parameter without having to set it manually for every page? All pages where I want to add this route parameter use render mode Interactive Server.

Suppose I have 3 separate components with different routes:

@page "/home"@page "/faq"@page "/contact"

Now for example I want to add some localization by using a route parameter. I could set this manually on every single page:

@page "/{culture}/home"@page "/{culture}/faq"@page "/{culture}/contact"

But I would prefer a global solution where some route parameters are automatically defined for every page. If I want to add another route parameter later on, I can set it in one place instead of manually on every page component.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>