As the title suggests, I am binding a WebDataTree to an IEnumerable list at runtime. The IEnumerable has a list property (also an IEnumerable) and so on, which the WebDataTree picks up fine. However, the names of all nodes are represented as the fully qualified name of the class (e.g. Phoenix.DataNodes.ClienNode).
How can I tell the WebDataTree to bind to a specific property in the IEnumerable so that the text displayed is the underlying value of that property?
I seem to have resolved the first issue by applying a template to each node on the NodeBound event. However, I now have a new issue. After a postback, every node loses the previously bound DataItem.
Keeping in mind that I'm binding the data programmatically (as these are IEnumerable's and not datasets as all the examples seem to use), how can I ensure that all the nodes in the tree persist their DataItems after a postback, or alternatively, how can I create a binding source in the ASPX page that creates the children from an IEnumerable property in the parent?
Thanks,
Alex
Hello Alex,
Thank you for writing in our community.
I have created a basic sample for you to show you how to bind the WebDataTree to IEnumerable. Please take a look at it and let me know is that what are you trying to accomplish. Also, can you please provide me more information on your case scenario or send me a working sample so I can better assist you. Additionally here are some resources that you might find useful:
Thanks for the reply.
I've given your example a shot, but the underlying objects seem to lose their binding on a postback (even if it's asynchronous). Any ideas?
I can see that on the initial bind the objects are there, but as soon as a click a node and the OnNodeClicked event is fired, all the objects tied to each node's DataItem property are lost.
Hi Alex,
I hooked to this event but the bound data stays there as expected.
Can you please let me know if there are any changes that you made to Marina's sample?
Hi there,
I should have been more clear, using our own structures the data becomes unbound. Our data has one IEnumerable structure (A ClientList) with an IEnumerable property called FundList (which points to the IEnumerable structure FundList). FundList has both a product and option list as properties also, so there are 3 levels.
On the first databind, I can see all nodes have the correct DataItem represented, and the correct structure is shown. However, as soon as I click on another node, upon stepping through the event, I can see that the ActiveNode's dataitem property is null, as is all other nodes.
Rebinding on every load isn't really an option, as we have around 80 clients, some with up to 10 funds, with up to 20 products and options in each of those funds (so it takes a bit to load).
Any ideas?