public void ChildColor(TreeNodeExt parent) { foreach (TreeNodeExt Child in parent.ChildNodes) { if (Child.Text == filter || Child.Text.Contains(filter)) { } ChildFilter(Child); } }
public void CheckChild(TreeNodeExt t) { if (t.ChildNodes.Count > 0) { foreach (TreeNodeExt tt in t.ChildNodes) { if (tt.Checked == true) { message += tt.Text.ToString() + "; "; } CheckChild(tt); } } }
public void ChildFilter(TreeNodeExt parent) { foreach (TreeNodeExt Child in parent.ChildNodes) { if (Child.Text == filter || Child.Text.Contains(filter)) { TemporaryTree.Nodes.Add(new TreeNodeExt { NodeId = Child.NodeId, NodeType = Child.NodeType, Value = Child.Value }); } ChildFilter(Child); } }
public void Copy(TreeViewExt treeview1, TreeViewExt treeview2) { TreeNodeExt newTn; foreach (TreeNodeExt tn in treeview1.Nodes) { newTn = new TreeNodeExt { NodeId = tn.NodeId, NodeType = tn.NodeType, Value = tn.Value }; if(tn.Checked) { newTn.Checked = true; } CopyChilds(newTn, tn); treeview2.Nodes.Add(newTn); } }
private void PopulateTree() { sampleTree.Nodes.Clear(); TreeNodeExt root = new TreeNodeExt(); root.Value = "root node"; sampleTree.Nodes.Add(root); // Creating some fake nodes for testing purposes for (int i = 0; i < 10; i++) { TreeNodeExt child = new TreeNodeExt(); TreeNodeExt doublechild = new TreeNodeExt(); TreeNodeExt ddoublechild = new TreeNodeExt(); child.NodeId = i; // Saved in ViewState child.NodeType = "Type " + i; // Saved in ViewState child.Value = child.NodeType; doublechild.NodeId = i; doublechild.NodeType = "Child " + i; doublechild.Value = doublechild.NodeType; ddoublechild.NodeId = i; ddoublechild.NodeType = "Type Child " + i; ddoublechild.Value = ddoublechild.NodeType; root.ChildNodes.Add(child); child.ChildNodes.Add(doublechild); if (i%2==0) { doublechild.ChildNodes.Add(ddoublechild); } } }
public void CopyChilds(TreeNodeExt parent, TreeNodeExt willCopied) { TreeNodeExt newTn; foreach (TreeNodeExt tn in willCopied.ChildNodes) { newTn = new TreeNodeExt { NodeId = tn.NodeId, NodeType = tn.NodeType, Value = tn.Value }; if (tn.Checked) { newTn.Checked = true; } parent.ChildNodes.Add(newTn); CopyChilds(newTn, tn); } }