Reputation: 11
This is my quickgrid:
<QuickGrid Items="@Items" Theme="MyGrid" @ref="quickGrid" Pagination="@pagination">
<PropertyColumn Property="@(p => p.Id)" Sortable="true" Class="p-2" />
<PropertyColumn Property="@(p => p.LabelCode)" Sortable="true" Class="p-2" />
<PropertyColumn Property="@(p => p.Employee.Name)" Sortable="true" Class="p-2" />
</QuickGrid>
This is my dbContext
:
_dbContext.Asset
.Include(c => c.Employee)
.ToListAsync();
EmployeeId
is nullable.
If EmployeeId
is null, the grid doesn't work.
How can I handle this to show empty cell?
Upvotes: 0
Views: 422
Reputation: 11
i use this solution for now:
<TemplateColumn Title="Employee" Class="p-2" Sortable="true">
@if (context.EmployeeId != null)
{
<span> @context.Employee.Name </span>
}
</TemplateColumn>
Upvotes: 1