I have a tree that utilizes ManualSmartCallbacks to load certain nodes. When the page loads, the tree loads an Accounts root and the names of all of the accounts as follows:
Node root = treeClientAccounts.Nodes.Add("Accounts", "AccountsRoot");
Node acct = root.Nodes.Add(NodeName, NodeKey); //Name and Key (Tag) are from a data table
acct.ShowExpand = true;
}
When the node is expanded for one of these account nodes the DemanLoad event is fired and I can load the children in a similar fasion. Most of these children are just leaf nodes, however, some of them will have child nodes and I want to utilize the DemandLoad funtionality the same way as above. The problem is that when the DemandLoad event fires on these nodes that were loaded on demand in the previous step, no way of identifying the node available. e.Node.Tag, e.Node.Name, e.Node.[Whatever] is all null or empty. How can I assign a Tag (or anything else) during the DemandLoad event so that its available the next time the DemandLoad event is called?
Hopefully this makes some sense. If not, let me know and I can give you more detail and code.
Thanks.
Yes, I believe I got the problem (and was able to reproduce it). Tag is not persisted which may be expected btw, due to the nature of Ajax calls.
I believe in this case you can se node.DataPath = "some data" - I was able to confirm that DataPath is correctly persisted for all nodes using ManualSmartCallBack.
Hope this helps.
I have a webtree in an application that holds reports for various things and I can defintely say that the DataPath property is the one you need to be using. Assign it the ID of the record in your dataset or whatever, and that way in the DemandLoad event you can access that ID and search for its children in the dataset/database and then bind the new nodes.
If any of the items you are adding to the node in that event are to have children...set the Node.ShowExpand = True when adding the node...