views:

584

answers:

1

Hi,

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!

+1  A: 

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.

Ronald Wildenberg
Damn, I was so into declarative stuff that I didn't think of checking the events. That will do just fine, thanks!
Luk