private void _tvTree_AfterExpand(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            if (_isInitialized == true)
            {
                _tvTree.SelectedNode = e.Node;

                NodeDesign selNode = (NodeDesign)_tvTree.SelectedNode.Tag;

                if (selNode != null)
                {
                    selNode.Expanded           = true;
                    _pgTreeView.SelectedObject = selNode;
                }
            }
        }
        private System.Windows.Forms.TreeNode AddNodes(System.Windows.Forms.TreeNodeCollection parentCollection)
        {
            System.Windows.Forms.TreeNode ret = null;

            foreach (System.Windows.Forms.TreeNode child in parentCollection)
            {
                TreeNode treeNode = _treeView.FindNode((string)((NodeDesign)child.Tag).Key);

                NodeDesign currentNode = (NodeDesign)child.Tag;
                if (treeNode == null)
                {
                    TreeNode newNode = null;

                    if (child.Parent == null)
                    {
                        newNode = _treeView.AddNode(currentNode.Key, currentNode.Text, currentNode.Link, currentNode.Target, currentNode.Expanded, currentNode.Icon, currentNode.NodeStyle);
                    }

                    else
                    {
                        newNode = _treeView.FindNode((string)((NodeDesign)child.Parent.Tag).Key).AddNode(currentNode.Key, currentNode.Text, currentNode.Link, currentNode.Target, currentNode.Expanded, currentNode.Icon, currentNode.NodeStyle);
                    }

                    if (_treeView.SelectionType == SelectionType.CheckBox)
                    {
                        newNode.Selected = child.Checked;
                    }
                    else
                    {
                        newNode.Selected = false;
                    }
                }

                if (child.GetNodeCount(false) > 0)
                {
                    ret = AddNodes(child.Nodes);
                }

                if (ret != null)
                {
                    break;
                }
            }

            return(null);
        }
        private System.Windows.Forms.TreeNode AddNodeTreeWindows(System.Web.UI.ControlCollection parentCollection, TreeNode Parent)
        {
            System.Windows.Forms.TreeNode ret = null;

            foreach (object control in parentCollection)
            {
                ActiveUp.WebControls.TreeNode child = control as ActiveUp.WebControls.TreeNode;
                if (child != null)

                {
                    System.Windows.Forms.TreeNode newNode = new System.Windows.Forms.TreeNode(child.Text);
                    if (child.Expanded == true)
                    {
                        newNode.Expand();
                    }

                    NodeDesign nodeList = null;

                    if (Parent == null)
                    {
                        _tvTree.Nodes.Add(newNode);

                        nodeList = new NodeDesign(child.Key, "0", child.Text, child.Link);
                    }

                    else
                    {
                        System.Windows.Forms.TreeNode parentNode = GetNode(Parent.Key, _tvTree.Nodes, TypeSearch.searchID);
                        if (parentNode != null)
                        {
                            parentNode.Nodes.Add(newNode);
                        }

                        nodeList = new NodeDesign(child.Key, Parent.Key, child.Text, child.Link);
                    }

                    nodeList.Target    = child.Target;
                    nodeList.Expanded  = child.Expanded;
                    nodeList.Selected  = child.Selected;
                    nodeList.Icon      = child.Icon;
                    nodeList.NodeStyle = child.NodeStyle;

                    if (child.Selected == true)
                    {
                        newNode.Checked = true;
                    }

                    newNode.Tag = nodeList;

                    if (child.Nodes.Count > 0)
                    {
                        ret = AddNodeTreeWindows(child.Nodes, child);
                    }

                    if (ret != null)
                    {
                        break;
                    }
                }
            }

            return(ret);
        }