It works in 1st entity (customer) but does not worked on 2nd entity (item). both came from http client API
Here is the base
protected async override Task OnInitializedAsync()
{
// Service fetch data from API
Customers = (await CustomerService.GetCustomers()).OrderBy(e => e.CustomerName).ToList();
StateHasChanged();
Terms = (await TermService.GetTerms()).ToList();
StateHasChanged();
}
Here is the razor
@*Customer*@
<div class="col-lg-12 control-section">
<div class="control_wrapper">
<SfComboBox TItem="Customer" TValue="int" AllowCustom="false" Autofill="true" Placeholder=" Select Customer" CssClass="e-multi-column" AllowFiltering="true" DataSource="@Customers" PopupHeight="300px" @bind-Value="SOHeaderEditModel.CustomerID">
<ComboBoxTemplates TItem="Customer">
<HeaderTemplate>
<table><tr><th class="e-text-center combo-width">Customer Code</th><th>Customer Name</th><th>Area</th></tr></table>
</HeaderTemplate>
<ItemTemplate Context="ComboContext">
<table><tbody><tr><td class="e-text-center combo-width">@((ComboContext as Customer).CustomerID)</td><td>@((ComboContext as Customer).CustomerName)</td><td>@((ComboContext as Customer).Area.AreaName)</td></tr> </tbody></table>
</ItemTemplate>
</ComboBoxTemplates>
<ComboBoxFieldSettings Value="CustomerID" Text="CustomerName"></ComboBoxFieldSettings>
</SfComboBox>
</div>
</div>
@*Term*@
<div class="col-lg-12 control-section">
<div class="control_wrapper">
<SfComboBox TItem="Term" TValue="int" AllowCustom="false" Autofill="true" Placeholder=" Select Term" CssClass="e-multi-column" AllowFiltering="true" DataSource="@Terms" PopupHeight="300px" @bind-Value="SOHeaderEditModel.TermID">
<ComboBoxTemplates TItem="Term">
<HeaderTemplate>
<table><tr><th class="e-text-center combo-width">Term Code</th><th>Term Name</th><th>Area</th></tr></table>
</HeaderTemplate>
<ItemTemplate Context="ComboContext">
<table><tbody><tr><td class="e-text-center combo-width">@((ComboContext as Term).TermID)</td><td>@((ComboContext as Term).TermName)</td><td>@((ComboContext as Term).Conversion.ToString())</td></tr> </tbody></table>
</ItemTemplate>
</ComboBoxTemplates>
<ComboBoxFieldSettings Value="TermID" Text="TermName"></ComboBoxFieldSettings>
</SfComboBox>
</div>
</div>
Must be there is an alternative event for OnInitializedAsync()
Both entity list (Customer and term) works in datagrid. so there is no error in the API service..