Blazor will look at the type of the EmployeeId and EmployeeName parameters and try to find cascading values that match. In this case, EmployeeId will match Id and EmployeeName will match Name.
Parent component
@page "/cascading"
<CascadingValue Value="@Id">
<CascadingValue Value="@Name">
<CascadingChild></CascadingChild>
</CascadingValue>
</CascadingValue>
@code {
int Id = 1;
string Name = "Test";
}
Child component
<p>Employee Id:@EmployeeId </p>
<p>Employee Name:@EmployeeName </p>
@code {
[CascadingParameter]
private int EmployeeId { get; set; }
[CascadingParameter]
private string EmployeeName { get; set; }
}
Share with