RadzenDataGrid with Foreach in RadzenTab

Hi,
Im using RadzenDataGrid with foreach in RadzenTab.
I have enum and im using foreach for create Tab and DataDrid.
Im using RadzenTab with Server Mode.
When i click to another tab, there is not event triggered.

Here is my code.

<RadzenCard Class="mt-0 col-md-12 col-12">
    <h3 class="mb-3">Cari Hesaplar</h3>
    <RadzenTabs TabPosition="@TabPosition.Top" Class="mt-0 col-md-12 col-12" RenderMode="TabRenderMode.Server" Change="OnChangeTab">
        <Tabs>

            @foreach (CariType type in Enum.GetValues(typeof(CariType)).Cast<CariType>().ToList().OrderBy(x => x.GetOrder()))
            {

                <RadzenTabsItem Text="@type.GetDisplayName()">
                    <CariListComponent cariType="@type"></CariListComponent>
                </RadzenTabsItem>
            }
        </Tabs>
    </RadzenTabs>
</RadzenCard>

CariListComponent.cs

<RadzenDataGrid Count=@Count @ref="grid" PageSize=25  TItem="AccountDTO" Data="@accounts" LoadData=@LoadData> 
    <Columns>
        <RadzenDataGridColumn TItem="AccountDTO"  Property="IsActive" Filterable="true" Sortable=false Title="Aktif Mi?" Frozen="false" Width="40px">
            <HeaderTemplate>
                <RadzenCheckBox TriState="false" TValue="bool" Disabled="true" />
            </HeaderTemplate>
            <Template Context="data">
                <RadzenCheckBox TriState="false" TValue="bool" Value="@data.IsActive" />
            </Template>
        </RadzenDataGridColumn>
        <RadzenDataGridColumn TItem="AccountDTO" Property="Id" Filterable="true" Title="ID" Frozen="false" Width="50px" TextAlign="TextAlign.Center" />
    </Columns>
</RadzenDataGrid>

Hi @serkanaslan,

Try setting the @key attribute of the RadzenTabsItem element:

<RadzenTabsItem Text="@type.GetDisplayName()" @key="@type.GetDisplayName()">

There is nothing changed. Still same.

We will need additional info in this case. Please check our FAQ for tips how to improve your question.

When I add other components including datagrid, the onload event of the datagrid inside each component works. but if I use one component with foreach multiple times, onload and oninitializeddasync are not triggered.

Try setting the @key attribute of the CariListComponent too. Blazor may be caching it.

 <CariListComponent @key="@type.GetDisplayName()" cariType="@type"></CariListComponent>

Hi again @korchev.
I solved problem with adding @key attribute to component. Thanks for your help.

Best regards.