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
85
WebDataTree, InitialDataBindDepth, manually loading when needed
posted

Have this WebDataTree:

<ig:WebDataTree ID="itemtree" class="ItemTree" runat="server"
DataSourceID="hdsItem" SelectionType="Single"
NodeIndent="10" InitialDataBindDepth="1">
<AutoPostBackFlags SelectionChanged="On" />
<DataBindings>
<ig:DataTreeNodeBinding DataMember="dsItemCategoryRoot_DefaultView"
KeyField="CategoryID" TextField="Description" ValueField="CategoryID"
TargetField="Category" />
<ig:DataTreeNodeBinding DataMember="dsItemCategory_DefaultView"
KeyField="CategoryID" TextField="Description" ValueField="CategoryID"
TargetField="Category" />
<ig:DataTreeNodeBinding DataMember="dsItem_DefaultView" KeyField="InventoryID"
TextField="Name" ValueField="InventoryID" TargetField="Inventory" />
</DataBindings>
</ig:WebDataTree>

...that is bound to a datasource and setup to automatically download nodes on demand, with a InitialBindDepth of 1.
It works perfectly, it loads all the root nodes and then loads a set of children when I expand a node.

I also have some code that seeks a certain node in the tree. (code below) It finds the node by key, then sets that as the active node, expands it, and expands all ancestors to that point. The problem is, while it allows me to set that as the active node, the children of that node might not be loaded yet. Is there a way I can continue to have it load on demand, but also manually force it to load the children of a certain node if I need to?

itemtree.ActiveNode = MyNode
itemtree.ActiveNode.Expanded = True
itemtree.ActiveNode.ExpandAnscestors()
itemtree.ActiveNode.Selected = True

Parents
No Data
Reply
  • 85
    posted

    In case my request didn't make any sense, here's an example of what I am looking for. Hopefully it is more clear.

    I have a tree that looks like this:

    .A
    .     A1
    .         A1a
    .         A1b
    .         A1c
    .     A2
    .     A3
    .B
    .     B1
    .     B2
    .C
    .D

    The tree is set with InitialDataBindDepth="1" so that only the first level of nodes, A, B, C, D are initially loaded.

    What if when the page loads, I want to jump directly to node A1a. I want to make it be the active node, and to have the child nodes of it and all of its ancestors be loaded. Therefore you would see A, B, C, D, A1, A2, A3, and A1a, A1b, A1c
     

Children