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?

  • 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

  • 7694
    posted

     Hello,
    You can use the WebTreeNodeEventArgs e to work with current selected node. Please take a look at the code below:
    protected void tree_NodeSelectionChanged(object sender,
            Infragistics.WebUI.UltraWebNavigator.WebTreeNodeEventArgs e)
        {
            TextBox1.Text = e.Node.Text;
            //You can use also other properties of the node:
            //e.Node.DataKey;
            //e.Node.DataPath;
        }
    Also you can take a look links:
    CSOM : http://help.infragistics.com/NetAdvantage/NET/2008.3/CLR3.5/
    Samples: http://samples.infragistics.com/2008.3/WebFeatureBrowser/Default.aspx
    Hope this helps.