Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
Programmatically binding WebDataTree to IEnumerable, then setting TextField and ValueField
posted

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?

Parents
  • 585
    posted

    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

Reply Children