MatthewM wrote:
jtgooding wrote:
Not sure I know of any tree control that implements IEnumerable, the issue is IEnumerable does not implement another interface (escapes me at the moment) which defines the relationships between parents and children objects.
This really isn't a Telerik issue IMO.
I disagree. The reason being: I can bind their tree to a DataTable that contains the heirarchical relationship via a parent Id field. Since a DataTable implements IListSource which of course is just a collection of records, the same logic holds for an EntityCollection.
Which also implements IListSource
IListSource doesn't do a lot, it just returns the real data container. What telerik likely does is check if the type of the bound object is a dataset. If not, it won't go further. It wouldn't be the first control vendor who pulls that cheap trick.
However as this is a hierarchical control, it might be they implemented the hierarchies hardcoded with datarelations.
Ex, I can provide the Telerik tree a DataTable that references itself via a ParentId field and produce trees of N depth.
tree.DataFieldID = "CategoryId";
tree.DataFieldParentID = "ParentCategoryId";
tree.DataTextField = "Name";
tree.DataValueField = "CategoryId";
Admittedly, they did a good job, making it very easy to bind like related data, such as a virtual folder structure. By their own admission, anything that implements IEnumerable is a valid datasource:
r.a.d.treeview can be bound to datasources that implement the IListSource interface (DataSet / DataTable) and / or IEnumerable. You can implement IListSource in your custom datasource...
If that's true, you should be able to bind an entity collection, as it implements IListSource. However because this is asp.net 2.0, it might be they need a hierarchical datasource, which isn't supported by the llblgen pro datasource controls. If they can work with a normal datasource control, they should be able to reproduce it, as an entity collection simply implements IListSource and should work. But again, IListSource is really simple. It depends on what they're doing with the IList returned by IListSource