In Blazor you can get an instance of a component by creating a component reference. To capture a component reference: Add an @ref attribute to the child component. Define a field with the same type as the child component.
Child component to parent component communication For this the child component exposes an event. The parent component assigns a callback method to the child component's event. In Blazor, to expose an event we use EventCallback .
By using Blazor route parameters, you can pass values from one page to another page. Use NavigationManager to pass a value and route the parameter to another page. Follow this example to achieve passing values from one page to another. Get the passed Page1 parameter value in Page2.
i have two component. The first component includes list of model and the second component contains modal form I want to click on the model when inside the first component In the second component, open modal and edit the model how to call show function in child component from parent component
<ChildComponent /> <button onClick="@ShowModal">show modal</button> @code{ ChildComponent child; void ShowModal(){ child.Show(); } }
i'm used @using but this code has error :
the type or namespace name ChildComponent coud not be found
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With