Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How can I refer to a component created via DynamicComponent in Blazor?

$
0
0

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                              Type=@System.Type.GetType(oneTabItem.TabComponent)                              Parameters=@oneTabItem.TabParameters></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?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>