Posts

Showing posts from January, 2022

Cascading Values and Cascading Parameters in Blazor

Image
This blog is going to explain what Cascading values and Cascading parameters are. And it is going to explain with examples how to use them. You can easily transfer values from parent to child components using cascading values and cascading parameters. Let's look at a small example. There are two components: parent and child components. In the code below, a text box is included to get the value to send to child components. Added CascadingValue component with value attribute to send value. Inside the CascadingValue a child component was added to get the value. Parent.razor @page "/Parent" <h3>Parent Component</h3> Enter Value to Pass: <input type="text" @bind="@ValueToPass" /> <br /><br /> <CascadingValue Value="@ValueToPass">     <Child></Child> </CascadingValue> @code {     int ValueToPass = 100; } Below one is a child component code. Here the [CascadingParame