Q:

How do you pass multiple parameters using cascading values in Blazor by type?

0

his code will help you to understand how to pass multiple parameters using cascading values in Blazor by type.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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; }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now