|
this is my loaddata
private BindableList<Employee> _employees = new BindableList<Employee>();
var query = _em.BasePersons .Include(Employee.PathFor(sa => sa.CommissionCode)) .Include(Employee.PathFor(sa => sa.SalesInvoiceAgents)) .Include(Employee.PathFor(sa => sa.Address)) .Include(Employee.PathFor(sa => sa.Address.Country)) <-- the moment i include this it fails .OfType<Employee>();
_employees.ReplaceRange(query.ToList());
I made sure every employee had an address and each address has a country assigned to it
Then I create my grid and bind the data
GridControl employeeGridControl; XtraGridBindingManager bindingManager; _GridBuilder2.CreateGrid(out employeeGridControl, out bindingManager, _employeeBS, typeof(Employee));
_GridBuilder2.AddColumn(bindingManager, Employee.PathFor(e => e.Name)); _GridBuilder2.AddColumn(bindingManager, Employee.PathFor(e => e.CommissionCode.AlfaCode)); _GridBuilder2.AddColumn(bindingManager, Employee.PathFor(e => e.NumberOfUnpaidInvoices)); _GridBuilder2.AddColumn(bindingManager, Employee.PathFor(e => e.Address.City)); _GridBuilder2.AddColumn(bindingManager, Employee.PathFor(e => e.Address.Country.NameNld));
I had the same problem before with other data and then I could resolve the problem by adding an include in the loaddata of the extra data needed
|