I am trying to migrate from the UltraWebTree control to the latest Infragistics WebDataTree control and I have the following code:
protected void BindTree() { ClearAll(); if (this.mTreeList == null) { return; } Node parentNode; Node childNode; Dictionary<int, Node> parentNodes = new Dictionary<int, Node>(((ICollection<IDataItem>) this.mTreeList).Count); foreach (IDataItem item in this.mTreeList) { if ((int) item["org_level"] == 1) { parentNode = new Node(); parentNode.Text = item["name"].ToString(); parentNodes.Add((int) item["orgunit_id"], parentNode); Nodes.Add(parentNode); } else { parentNode = parentNodes[(int) item["parent_id"]]; childNode = new Node(); childNode.Text = item["name"].ToString(); parentNode.Nodes.Add(childNode); parentNodes.Add((int) item["orgunit_id"], childNode); } } //this.ExpandAll(); }
What are the corresponding methods for ClearAll() and Node in the new WebDataTree control?
I found ClearDataItems() and DataTreeNode in the assemblies. Are these the correct replacements?
Thanks.
Hello Samir,
Thank you for posting in our community.
The DataTreeNode is the class that represents a data tree node in WebDataTree and here are all available properties and methods exposed by DataTreeNode class: http://help.infragistics.com/doc/ASPNET/2014.1/CLR4.0/?page=Infragistics4.Web.v14.1~Infragistics.Web.UI.NavigationControls.DataTreeNode_members.html
There is no "ClearAll" method in the WebDataTree, however you may use something similar to WebDataTree1.Nodes.Clear() if you want to remove the nodes from the tree.
Please take a look at the above link and you will have a clearer picture about DataTreeNode's members. If you have any further questions, feel free to contact me.
Sincerely,
Tsanna