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. 

image.png

It then allows you to write code that renders different HTML.

image.png