private void LoadNodes(MCS.Web.Responsive.WebControls.DeluxeTreeNode oItem, TreeNode oTreeNode) { oTreeNode.Tag = oItem; foreach (MCS.Web.Responsive.WebControls.DeluxeTreeNode oChild in oItem.Nodes) { TreeNode oChildNode = new TreeNode(oChild.Text); LoadNodes(oChild, oChildNode); oTreeNode.Nodes.Add(oChildNode); } }
/// <summary> /// new root /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _addRootButton_Click(object sender, EventArgs e) { MCS.Web.Responsive.WebControls.DeluxeTreeNode oItem = new MCS.Web.Responsive.WebControls.DeluxeTreeNode(); oItem.Text = "New Root"; Items.Add(oItem); TreeNode oNewTreeNode = new TreeNode("New Root"); oNewTreeNode.Tag = oItem; _treeView.Nodes.Add(oNewTreeNode); _treeView.SelectedNode = _treeView.Nodes[_treeView.Nodes.Count - 1]; }
/// <summary> /// new child /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _addChildButton_Click(object sender, EventArgs e) { if (_treeView.SelectedNode == null) { return; } MCS.Web.Responsive.WebControls.DeluxeTreeNode oItem = (MCS.Web.Responsive.WebControls.DeluxeTreeNode)_treeView.SelectedNode.Tag; MCS.Web.Responsive.WebControls.DeluxeTreeNode oNewItem = new MCS.Web.Responsive.WebControls.DeluxeTreeNode(); oNewItem.Text = "New Item"; oItem.Nodes.Add(oNewItem); TreeNode oNewTreeNode = new TreeNode("New Item"); oNewTreeNode.Tag = oNewItem; _treeView.SelectedNode.Nodes.Add(oNewTreeNode); _treeView.SelectedNode.Expand(); }