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
20
Need equivalent in WebDataTree (c#)
posted

Hi ,

Please provide equivalent for below code in webdatatree for GetNodeFromId, below code is writeen for UltraWebTree.If  pass node index node text is required in c#(serverside code)

selectIndex  = TreeView1_1_1;

TreeView1.SelectedNode = TreeView1.GetNodeFromId(selectIndex);

Thanks

Ravi

  • 10685
    Suggested Answer
    Offline posted

    Hello Ravi, 

    As the new control architecture is completely different, it is not possible to use the same approach.

    It is possible to access the Nodes collection using AllNodes. What is more, if using Key, you could be able to uniquely identify each node. If this is not required, you could simply iterate AllNodes collection to get a desired Node. For example, the following code will select a particular node (first one) from AllNodes collection upon PostBack.

     

        protected void Page_Load(object sender, EventArgs e)

        {

            //select a node from the WDT on postback

            if (IsPostBack)

            {

                ArrayList nodesList = WebDataTree1.AllNodes;

                DataTreeNode node = (DataTreeNode)nodesList[0];

                node.Selected = true;

                this.WebDataTree1.SelectedNodes.Add(node);

            }

        }           

    What is more, regarding the migration you could refer to the already existing discussions in the community. In particular:

    Reg: Need help on Infragistics WebDataTree Node Properties & methods

    Replacing UltraWebTree with WebDataTree