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
1600
How to identify which node is selected when multiple nodes have the same text
posted

If every node has its own unique text, this is very easy.

in

Handles UltraWebTree1.NodeSelectionChanged

I can use selectedNode.Text however since there are multiple nodes have the same name this is not going to work.

In Page_Init I added a bunch of nodes and get the index put it into Private variable such as

Private RootNodeIndex as integer

Page_Init()

RootNodeIndex = ANode.Index

and inside UltraWebTree1_NodeSelectionChanged procedure

I used

Dim nodeIndex as integer = selectedNode.Index

Select Case nodeIndex

When I choose ANode the nodeIndex supposed to be the value of RootNodeIndex however

everytime I tested it turns out to be 0.

Looks like the private RootNodeIndex value does not hold as it did before postback.

Do we have any good resolution for this matter?

Parents
No Data
Reply
  • 570
    posted

    each ultrawebtree node has 2 additional properties. They are:

    1.) node.Tag

    2.) node.DataKey

    while initializing a tree, you can use a variable to set value with each node's tag property and increment it, so that each node gets unique tag. And inside the void UltraWebTree1_NodeSelectionChanged(object sender, WebTreeNodeEventArgs e) method, you can use:

    int tag =Convert.ToInt32(e.Node.Tag.ToString()); to retrieve unique tag for each node.

    And if you need to search a tree for a specific node using its tag, you can use:

    Infragistics.WebUI.UltraWebNavigator.Node searchNode= UltraWebTree1.Find("type the tag as string"); it will find the node with that tag

Children
No Data