private TreeNode AddElement(ref ActiveUp.WebControls.Nodes nodes, TreeNode newNode)
        {
            if (newNode != null)
            {
                nodes.NodesList.Add(new ActiveUp.WebControls.Node(newNode.Key, newNode.Parent.ID, newNode.Text, newNode.Link));
            }

            if (this.Nodes.Count > 0)
            {
                foreach (TreeNode node in this.Nodes)
                {
                    bool isAlreadyIn = false;
                    for (int i = 0; i < nodes.NodesList.Count; i++)
                    {
                        if (((ActiveUp.WebControls.Node)nodes.NodesList[i]).Key == node.Key)
                        {
                            isAlreadyIn = true;
                            break;
                        }
                    }

                    if (isAlreadyIn == false)
                    {
                        if (this.AddElement(ref nodes, node) != null)
                        {
                            return(this.AddElement(ref nodes, node));
                        }
                    }
                }
            }

            return(null);
        }
        /// <summary>
        /// Load a treeview structure from a xml file.
        /// </summary>
        /// <param name="fileName">File path of the xml file.</param>
        public void LoadFromXml(string fileName)
        {
            TextReader    reader     = new StreamReader(fileName);
            XmlSerializer serializer = new XmlSerializer(typeof(ActiveUp.WebControls.Nodes));

            ActiveUp.WebControls.Nodes nodes = (ActiveUp.WebControls.Nodes)serializer.Deserialize(reader);
            reader.Close();

            if (nodes.NodesList.Count > 0)
            {
                foreach (ActiveUp.WebControls.Node n in nodes.NodesList)
                {
                    if (n.ParentKey == "0")
                    {
                        ActiveUp.WebControls.TreeNode node = this.AddNode(n.Key, n.Label, n.Link, n.Target, n.Expanded, n.Icon);
                        //this.Controls.Add(node);
                    }

                    else
                    {
                        ActiveUp.WebControls.TreeNode node = this.FindNode(n.ParentKey).AddNode(n.Key, n.Label, n.Link, n.Target, n.Expanded, n.Icon);
                        //this.Controls.Add(node);
                    }
                }
            }
        }