Question

I have an external datasource that implements IHierarchicalEnumerable. I'm trying to use that datasource for my TreeView, but I can't find a way to specify the images and individual navigation urls the control should render (there is some business logic there).

The examples I have seen all assume the Url and the Name and Image fields are directly available in the datasource but this is not the case here.

I tried to create an other datasource as a proxy implementing these properties, but this proves to be much harder than expected (due to GetHierarchyData().GetChildren()) so I hope there is an other way.

Thanks for the help!

Was it helpful?

Solution

You should take a look at the TreeNodeDataBound event of the TreeView control. In the event handler you can alter node properties (like image url or text) based on certain conditions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top