I'm new to Blazor and I'm probably doing this wrong, but I am trying to load data from a database during the OnInitializationAsync and the dropdownlist will not display any data. How should I accomplish this?
<SfDropDownList TItem="TGame" TValue="string" Placeholder="Select Game" PopupHeight="auto">
<DropDownListEvents TValue="string" ValueChange="onChange"></DropDownListEvents>
<DropDownListFieldSettings Value="GameName Text="GameName"></DropDownListFieldSettings>
</SfDropDownList>
@code{
DataContext db = new DataContext();
public List<TGame> Games { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
Games = await db.TGame.ToListAsync();
}
}