I have two classes Employee and Department as follows
class Employee
{
public string ID {get;set;}
public string Name {get;set;}
public List<Departments> AssociatedDepartment {get;set;}
}
class Department
{
public string DepartmentID {get;set;}
public string DepartmentName {get;set;}
}
I am binding a DataGridView with List<Employee>. It is showing list of Employees but not Department of the employees.
List<Employee> employeeList = GetEmployeeList();
if (employeeList != null)
{
grdResponse.DataSource = employeeList;
}
Now it is showing following data.
ID Name
---------
1 Joe
2 Tim
What should I do to get following?
ID Name Department
--------------------
1 Joe Software
1 Joe Management
2 Tim Hardware
An Employee can have more than one department public List<Departments> AssociatedDepartment {get;set;}Employeecan have more than oneDepartment.