Live Chat Icon For mobile
Live Chat Icon

How does the route parameter assign values to properties in Blazor?

Platform: Blazor| Category: Routing

Blazor doesn’t consider the word casing and it just assigns the value if the name is matched.

@page "/RouteParameter"
@page "/RouteParameter/{name}"

<h1>Welcome to blazor : @Name !!!</h1>

@code {
       public string Name { get; set; }

       protected override void OnInitialized()
             Name = Name ?? "David";

The router parses the name parameter from the URL and sets the value of the component. For instance, if the URL is /RouteParameter/JonSnow, the Name property will be set to “ JonSnow “.

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.