Hello,
I'm trying to build a DataList but I'm having an exception when populating the @matches var.
Can anyone take a quick look into this? Thanks in advance
The Exception is:
Severity | Code | Description | Project | File | Line | Suppression State |
---|---|---|---|---|---|---|
Error | CS0266 | Cannot implicitly convert type 'System.Linq.IQueryable<HighTide_Blazor.Data.HighTide.ApplyMatches>' to 'System.Collections.Generic.IEnumerable<HighTide_Blazor.Pages.ApplyMatches>'. An explicit conversion exists (are you missing a cast?) | HighTide | C:\Workspace\fintech-PoC\fintech-PoC\HighTide-Blazor\Pages\ApplyMatches.razor | 239 | Active |
@page "/matches"
@using Microsoft.EntityFrameworkCore
@attribute [Authorize(Roles = "Admin, Investor")]
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject Hightide_AppContext dbContext
<div class="row">
<div class="col-md-12">
<h3>Fieldset</h3>
<RadzenFieldset AllowCollapse="true">
<HeaderTemplate>
<span>
<RadzenIcon Icon="business_center" /><b style="font-size:30px">MATCHES</b>
</span>
</HeaderTemplate>
<ChildContent>
<RadzenDataList PageSize="1" WrapItems="true" AllowPaging="true"
Data="@matches" TItem="ApplyMatches">
<Template Context="ApplyMatches">
<RadzenCard>
<div class="row">
<div class="col-md-4">
<div>Company:</div>
<b>@ApplyMatches.DscWebsite</b>
<div style="margin-top:20px">Employee:</div>
<b>@ApplyMatches.DscNameStartup</b>
</div>
<div class="col-md-4">
<div>Freight:</div>
<b>@ApplyMatches.DscResume</b>
<div style="margin-top:20px">Ship country:</div>
<b>@ApplyMatches.DscCountry</b>
</div>
<div class="col-md-4">
<div>Freight:</div>
<b>@ApplyMatches.DscOther</b>
<div style="margin-top:20px">Ship country:</div>
<b>@ApplyMatches.DscWebsite</b>
</div>
</div>
</RadzenCard>
</Template>
</RadzenDataList>
</ChildContent>
</RadzenFieldset>
</div>
</div>
@code
{
// AuthenticationState is available as a CascadingParameter
[CascadingParameter]
private Task<AuthenticationState> authenticationStateTask { get; set; }
IEnumerable<ApplyMatches> matches;
protected override void OnInitialized()
{
matches = dbContext.ApplyMatches.Include("ApplyMatches").ToList();
}
}