Exemple #1
0
        private Accordion InitAccordionMenu()
        {
            Accordion accordionMenu = new Accordion();
            accordionMenu.ID = "accordionMenu";
            accordionMenu.EnableFill = true;
            accordionMenu.ShowBorder = false;
            accordionMenu.ShowHeader = false;
            Region2.Items.Add(accordionMenu);

            AccordionPane accordionPane;
            DataTable dt = App_Com.Sys_User.GetSys_Menu();
            foreach (DataRow dr in dt.Select("IsNull(PID,'')=''", "RID"))
            {
                accordionPane = new AccordionPane();
                accordionPane.Title = dr["MenuName"].ToString();
                accordionPane.Layout = Layout.Fit;
                accordionPane.ShowBorder = false;
                accordionPane.BodyPadding = "2px 0 0 0";
                accordionMenu.Items.Add(accordionPane);

                Tree treeMenu = new Tree();
                treeMenu.EnableArrows = true;
                treeMenu.ShowBorder = false;
                treeMenu.ShowHeader = false;
                treeMenu.EnableIcons = false;
                treeMenu.AutoScroll = true;
                BuildTree(dt, dr["RID"].ToString(), treeMenu, null);
                accordionPane.Items.Add(treeMenu);
            }
            return accordionMenu;
        }
Exemple #2
0
 private Accordion InitAccordionMenu()
 {
     Accordion accordionMenu = new Accordion();
     accordionMenu.ID = "accordionMenu";
     accordionMenu.EnableFill = true;
     accordionMenu.ShowBorder = false;
     accordionMenu.ShowHeader = false;
     Region2.Items.Add(accordionMenu);
     XmlDocument xmlDoc = XmlDataSource1.GetXmlDocument();
     XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");
     int accordionIndex = 0;
     int activeIndex = 0;
     foreach (XmlNode xmlNode in xmlNodes)
     {
         if (xmlNode.HasChildNodes)
         {
             AccordionPane accordionPane = new AccordionPane();
             accordionPane.Title = xmlNode.Attributes["Text"].Value;
             accordionPane.Layout = Layout.Fit;
             accordionPane.ShowBorder = false;
             accordionPane.BodyPadding = "2px 0 0 0";
             accordionPane.RowHeight = "40px";
             accordionMenu.Items.Add(accordionPane);
             Tree innerTree = new Tree();
             innerTree.EnableArrows = true;
             innerTree.ShowBorder = false;
             innerTree.ShowHeader = false;
             innerTree.EnableIcons = false;
             innerTree.AutoScroll = false;
             innerTree.Layout = Layout.Fit;
             accordionPane.Items.Add(innerTree);
             XmlDocument innerXmlDoc = new XmlDocument();
             innerXmlDoc.LoadXml(String.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Tree>{0}</Tree>", xmlNode.InnerXml));
             //绑定AccordionPane内部的树控件
             innerTree.DataSource = innerXmlDoc;
             innerTree.DataBind();
             foreach (var node in innerTree.Nodes)
             {
                 if (Request.Cookies["tabUrl"] != null)
                 {
                     string taburl = Server.UrlDecode(Request.Cookies["tabUrl"].Value);
                     if (taburl != "" && node.NavigateUrl == taburl)
                     {
                         //accordionMenu.ActiveIndex = accordionIndex;
                         Tab tab = new Tab();
                         tab.EnableIFrame = true;
                         tab.EnableClose = true;
                         tab.Title = node.Text;
                         tab.Icon = Icon.Page;
                         tab.IFrameUrl = node.NavigateUrl;
                         mainTabStrip.Tabs.Add(tab);
                         mainTabStrip.ActiveTabIndex = 1;
                         activeIndex = accordionIndex;
                     }
                 }
                 node.IconUrl = "/icon/vs_aspx.png";
                 node.EnablePostBack = false;
                 node.NavigateUrl = node.NavigateUrl;
                 string tabinfo = node.Text + "_" + node.NavigateUrl;
                 //node.OnClientClick = "AddTab('" + tabinfo + "','" + accordionIndex + "')";
             }
         }
         accordionIndex++;
     }
     return accordionMenu;
 }
Exemple #3
0
        /// <summary>
        /// 创建手风琴菜单
        /// </summary>
        /// <param name="menus"></param>
        /// <returns></returns>
        private Accordion InitAccordionMenu(List<Menu> menus)
        {
            Accordion accordionMenu = new Accordion();
            accordionMenu.ID = "accordionMenu";
            accordionMenu.EnableFill = true;
            accordionMenu.ShowBorder = false;
            accordionMenu.ShowHeader = false;
            regionLeft.Items.Add(accordionMenu);

            foreach (var menu in menus.Where(m => m.Parent == null))
            {
                AccordionPane accordionPane = new AccordionPane();
                accordionPane.Title = menu.Name;
                accordionPane.Layout = Layout.Fit;
                accordionPane.ShowBorder = false;
                accordionPane.BodyPadding = "2px 0 0 0";
                accordionMenu.Items.Add(accordionPane);

                Tree innerTree = new Tree();
                innerTree.EnableArrows = true;
                innerTree.ShowBorder = false;
                innerTree.ShowHeader = false;
                innerTree.EnableIcons = false;
                innerTree.AutoScroll = true;
                accordionPane.Items.Add(innerTree);

                // 生成树
                ResolveMenuTree(menus, menu, innerTree.Nodes);

            }

            return accordionMenu;
        }
        private Accordion InitAccordionMenu()
        {
            string rightstr = BaseRightStr;

            Accordion accordionMenu = new Accordion();

            accordionMenu.ID = "accordionMenu";
            accordionMenu.EnableFill = true;
            accordionMenu.ShowBorder = false;
            accordionMenu.ShowHeader = false;
            Region2.Items.Add(accordionMenu);

            foreach (sys_Menu m in sysMenuList.Where(p => p.PId == "0").OrderBy(p => p.SortIndex).ToList())
            {
                if (!rightstr.Contains(m.MenuCode + "-0"))
                    continue;
                AccordionPane accordionPane = new AccordionPane();
                accordionPane.Title = m.MenuName;
                accordionPane.Layout = Layout.Fit;
                accordionPane.ShowBorder = false;
                accordionPane.BodyPadding = "2px 0 0 0";
                accordionPane.IconUrl = m.Ico;
                accordionMenu.Items.Add(accordionPane);

                Tree innerTree = new Tree();
                innerTree.EnableArrows = true;
                innerTree.ShowBorder = false;
                innerTree.ShowHeader = false;
                innerTree.EnableIcons = false;
                innerTree.AutoScroll = true;
                accordionPane.Items.Add(innerTree);

                CreateNode(m.Id, innerTree.Nodes, rightstr);
            }
            return accordionMenu;

        }