I am rendering components using DynamicComponent and I need to call a function found in the child component.
I cannot find the equivalent of using @ref
for DynamicComponent
so that I can call a function of the dynamic component.
This is the parent component
<div class="tab-content">
@foreach (VerticalTabComponent.TabModel oneTabItem in VerticalTabsList)
{
<div class="tab-pane fade show @(oneTabItem.TabIndex == SelectedTabIndex ? "active" : "")" @key=@($"VTabDivDynamic_{TabPrefix}_{oneTabItem.TabIndex.ToString()}")>
<DynamicComponent
[email protected](oneTabItem.TabComponent)
[email protected]>
</DynamicComponent>
</div>
}
</div>
This is the code in Blazor Component Tab
public partial class TabComponent
{
[Parameter]
public EventCallback<string> InsertUpdateCallback { get; set; }
protected override async Task OnInitializedAsync()
{
await CallAnyfunctionAsync();
}
private async Task<bool> LoadDataGrid()
{
//this is the function I need to call from parent
}
}
How can I call the LoadDataGrid
function from the parent component?