Ejemplo n.º 1
0
        private void LoadDataMain()
        {
            menu m = menu.Root;

            if (m == null || m.Childs == null || m.Childs.Count < 1)
            {
                return;
            }
            m = m.Childs[0];
            if (m == null)
            {
                return;
            }
            EntityList <menu> list = Administrator.Current.Role.GetMySubMenus(m.ID);

            if ((list != null) && (list.Count > 0))
            {
                foreach (menu item in list)
                {
                    ExtAspNet.TreeNode tn = new ExtAspNet.TreeNode();
                    tn.Text     = item.Name;
                    tn.Expanded = true;
                    tn.Leaf     = false;

                    treeMenu.Nodes.Add(tn);
                    //循环得到父节点的子节点
                    ResolveSubTree(item, tn);
                }
            }
        }
Ejemplo n.º 2
0
        private void ResolveSubTree(menu entity, ExtAspNet.TreeNode treeNode)
        {
            EntityList <menu> list = Administrator.Current.Role.GetMySubMenus(entity.ID);

            if ((list != null) && (list.Count > 0))
            {
                foreach (NewLife.CommonEntity.Menu item in list)
                {
                    ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
                    node.Text     = item.Name;
                    node.Expanded = true;
                    if ((item.Url != null) && (item.Url != ""))
                    {
                        node.Leaf        = true;
                        node.NavigateUrl = item.Url;
                    }
                    else
                    {
                        node.Leaf = false;
                    }
                    treeNode.Nodes.Add(node);
                    //循环得到父节点的子节点
                    ResolveSubTree(item, node);
                }
            }
        }
Ejemplo n.º 3
0
 private void ResolveSubTree(menu entity, ExtAspNet.TreeNode treeNode)
 {
     EntityList<menu> list = Administrator.Current.Role.GetMySubMenus(entity.ID);
     if ((list != null) && (list.Count > 0))
     {
         foreach (NewLife.CommonEntity.Menu item in list)
         {
             ExtAspNet.TreeNode node = new ExtAspNet.TreeNode();
             node.Text = item.Name;
             node.Expanded = true;
             if ((item.Url != null) && (item.Url != ""))
             {
                 node.Leaf = true;
                 node.NavigateUrl = item.Url;
             }
             else
             {
                 node.Leaf = false;
             }
             treeNode.Nodes.Add(node);
             //循环得到父节点的子节点
             ResolveSubTree(item, node);
         }
     }
 }