Skip to main content

URL: Passing variables


Add the path

@page "/reader/{Id:int}"

Bind the parameter

[Parameter]
public string Id { get; set; }

 

It should be said that via the easy mix of code between the server and the GUI - this approach to pass variables might not the best way. 
But it could be used to implement an external facing URL, for example.

You'd then assign a variable with the @onclick - where the @-sign denotes it will be run on the server. 

Add the pathimage.png

@page

It "/reader/{Id:int}"

then allows you to write code that renders different HTML.

Bind the parameterimage.png

[Parameter]
public string Id { get; set; }