I have a simple table in my database called Department. In it there's a column called ParentDepartmentID that is a self referential foreign key ID. Here's an example of the data I have for testing purposes:
As you can see, Departments: Diagnostics and XRay are children to Office of Chancellor. And Laboratories is child to Diagnostics.
This is how I retrive an IQueryable<Department>
collection to my application using Entity Framework:
private DocumentsEntities db = new DocumentsEntities();
public IQueryable<Department> FindAllDepartments()
{
return db.Departments;
}
What format does the TreeView control require in order to parse and display the tree hierarchy correctly? Thank you.