Bind the IHierarchicalEnumerable to a tree structure and provide custom images and navigation addresses
I have an external data source that implements IHierarchicalEnumerable. I'm trying to use this datasource for my TreeView, but I can't find a way to specify the images and individual navigation urls that the control should display (there is some kind of business logic in there).
In the examples I've seen, all assume that the Url and Name and Image fields are available directly in the data source, but this is not the case here.
I tried to create another datasource as a proxy implementing these properties, but it turned out to be much more complicated than expected (due to GetHierarchyData (). GetChildren ()), so I hope there is another way.
Thanks for the help!
source to share
You should look at the TreeNodeDataBound event of the TreeView control. In your event handler, you can change the properties of the node (like image url or text) based on certain conditions.
source to share