Hi,
I need to display data that is located in different tables but connected via foreign keys. Is there a way to do that?
Hi,
I need to display data that is located in different tables but connected via foreign keys. Is there a way to do that?
If you have relationships you can use Include()
method to populate related property similar to this demo:
https://blazor.radzen.com/datalist
...
<div>Company:</div>
<b>@order.Customer?.CompanyName</b>
<div style="margin-top:20px">Employee:</div>
<b>@(order.Employee?.FirstName + " " + order.Employee?.LastName)</b>
....
IEnumerable<Order> orders;
protected override void OnInitialized()
{
orders = dbContext.Orders.Include("Customer").Include("Employee").ToList();
}