Exemplo n.º 1
0
        private void BindTree()
        {
            int roleId = GetSelectedDataKeyID(Grid1);
            IInfobasisDataSource db     = InfobasisDataSource.Create();
            XmlDocument          xmlDoc = db.ExecuteXmlDoc("Tree", "EXEC usp_SY_GetModuleTreeSetupXML @CompanyID, @UserID, @PermissionRoleID",
                                                           UserInfo.Current.CompanyID, UserInfo.Current.ID, roleId);

            XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");

            TreeModule.DataSource = xmlDoc;
            TreeModule.DataBind();
        }
Exemplo n.º 2
0
        private Tree InitTreeMenu()
        {
            Tree treeMenu = new Tree();

            treeMenu.ID                      = "treeMenu";
            treeMenu.ShowBorder              = false;
            treeMenu.ShowHeader              = false;
            treeMenu.EnableIcons             = true;
            treeMenu.AutoScroll              = true;
            treeMenu.EnableSingleClickExpand = true;

            if (_menuType == "tree" || _menuType == "tree_minimode")
            {
                treeMenu.HideHScrollbar  = true;
                treeMenu.ExpanderToRight = true;
                treeMenu.HeaderStyle     = true;

                //leftPanel.RegionSplit = false;
                //leftPanel.CssStyle = "border-right-width:0;";


                if (_menuType == "tree_minimode")
                {
                    treeMenu.MiniMode         = true;
                    treeMenu.MiniModePopWidth = Unit.Pixel(300);

                    leftPanelToolGear.Hidden       = true;
                    leftPanelBottomToolbar.Hidden  = true;
                    leftPanelToolCollapse.IconFont = IconFont.ChevronCircleRight;

                    leftPanel.Width    = Unit.Pixel(50);
                    leftPanel.CssClass = "minimodeinside";
                }
            }

            leftPanel.Items.Add(treeMenu);

            IInfobasisDataSource db     = InfobasisDataSource.Create();
            XmlDocument          xmlDoc = db.ExecuteXmlDoc("Tree", "EXEC usp_SY_GetModuleTreeXML @CompanyID, @UserID",
                                                           UserInfo.Current.CompanyID, UserInfo.Current.ID);

            ResolveXmlDocument(xmlDoc);

            // 绑定 XML 数据源到树控件
            treeMenu.NodeDataBound    += treeMenu_NodeDataBound;
            treeMenu.PreNodeDataBound += treeMenu_PreNodeDataBound;
            treeMenu.DataSource        = xmlDoc;
            treeMenu.DataBind();

            return(treeMenu);
        }
Exemplo n.º 3
0
        private Accordion InitAccordionMenu()
        {
            Accordion accordionMenu = new Accordion();

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


            IInfobasisDataSource db     = InfobasisDataSource.Create();
            XmlDocument          xmlDoc = db.ExecuteXmlDoc("Tree", "EXEC usp_SY_GetModuleTreeXML @CompanyID, @UserID",
                                                           UserInfo.Current.CompanyID, UserInfo.Current.ID);

            XmlNodeList xmlNodes = xmlDoc.SelectNodes("/Tree/TreeNode");

            foreach (XmlNode xmlNode in xmlNodes)
            {
                if (xmlNode.HasChildNodes)
                {
                    string accordionPaneTitle = xmlNode.Attributes["Text"].Value;
                    string isNewHtml          = GetIsNewHtml(xmlNode);
                    if (!String.IsNullOrEmpty(isNewHtml))
                    {
                        accordionPaneTitle += isNewHtml;
                    }

                    AccordionPane accordionPane = new AccordionPane();
                    accordionPane.Title      = accordionPaneTitle;
                    accordionPane.Layout     = Layout.Fit;
                    accordionPane.ShowBorder = false;

                    var accordionPaneIconAttr = xmlNode.Attributes["Icon"];
                    if (accordionPaneIconAttr != null)
                    {
                        accordionPane.Icon = (Icon)Enum.Parse(typeof(Icon), accordionPaneIconAttr.Value, true);
                    }

                    accordionMenu.Items.Add(accordionPane);

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

                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(String.Format("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Tree>{0}</Tree>", xmlNode.InnerXml));
                    ResolveXmlDocument(doc);

                    // 绑定AccordionPane内部的树控件
                    innerTree.NodeDataBound    += treeMenu_NodeDataBound;
                    innerTree.PreNodeDataBound += treeMenu_PreNodeDataBound;
                    innerTree.DataSource        = doc;
                    innerTree.DataBind();
                }
            }

            return(accordionMenu);
        }