DataGridColumn which I have housed within a <DataGrid/>:
<DataGridColumn TItem="Ticket" Field="@nameof(Ticket.Department.DepartmentName)" Caption="Department Name" Editable="true" />
this is my code block: @code {
private List<Department> ?Departments { get; set; }
protected override async Task OnInitializedAsync()
{
await TicketService.GetTickets();
await TicketService.GetDepartments();
}
}
ticket and department models:
public class Ticket
{
public int Id { get; set; }
public string Description { get; set; } = string.Empty;
public Boolean IsActive { get; set; } = true;
public DateTime Timestamp { get; set; } = DateTime.Now;
public Department? Department { get; set; }//
public int DepartmentId { get; set; }
}
public class Department
{
public int Id { get; set; }
public string DepartmentName { get; set; } = string.Empty;
}
VS2022 complies the code fine but after I deploy the page this error on developer console appears:
"Unhandled exception rendering component: Cannot detect the member of BlazorFullStackCrud.Shared.Ticket (Parameter 'DepartmentName')"
I am accessing a foreign key and Blazorise does not seem to want to fetch it from the database