当前位置: 首页>>代码示例>>C#>>正文


C# TreeNode.ExpandAll方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TreeNode.ExpandAll方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.ExpandAll方法的具体用法?C# TreeNode.ExpandAll怎么用?C# TreeNode.ExpandAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.TreeNode的用法示例。


在下文中一共展示了TreeNode.ExpandAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompletaAlbero

        private void CompletaAlbero(TreeNodeCollection nodes, Business.Entity.Guida guida)
        {
            var voce = Business.Entity.Guida.GetItem(Business.Entity.Guida.KeyColumnsEnum.Id, guida.Id);
            TreeNode node = new TreeNode(voce.Titolo, voce.Id.ToString());
            if (NodiEspansi.Contains(voce.Id)) node.ExpandAll();

            foreach (var item in GuidaCollection.GetList(wherePredicate: "IdPrec == @0", whereValues: new object[] { voce.Id }, orderPredicate: "Posizione ASC")) CompletaAlbero(node.ChildNodes, item);
            nodes.Add(node);
        }
开发者ID:bertasoft,项目名称:Network-Annunci,代码行数:9,代码来源:Guida.aspx.cs

示例2: GetChildNode

        private TreeNodeCollection GetChildNode(string RootNode, string[] valueArray, List<SPListItem> objListItemColn)
        {
            TreeNodeCollection childtreenodes = new TreeNodeCollection();
            SPQuery objSPQuery;
            SPListItemCollection objItems = null;
            List<SPListItem> objNodeListItems = new List<SPListItem>();
            SiteMapNodeCollection objNode = new SiteMapNodeCollection();
            objSPQuery = new SPQuery();
            string objNodeTitle = string.Empty;
            string objLookupColumn = string.Empty;
            StringBuilder Query = new StringBuilder();
            SPList objTaskList;
            SPField spField;
            string objKeyColumn;

            try
            {
                objTaskList = SPContext.Current.Web.Lists[objTreeViewControlField.ListName];
                objLookupColumn = objTreeViewControlField.ParentLookup;

                spField = SPContext.Current.Web.Lists[objTreeViewControlField.ListName].Fields[objTreeViewControlField.ParentLookup];
                if (this.ControlMode == SPControlMode.Display)
                {
                    objNodeListItems = (from SPListItem Item in objListItemColn
                                        where (new SPFieldLookupValue(Convert.ToString(Item[objTreeViewControlField.ParentLookup])).LookupValue == RootNode)
                                        orderby Item.ID
                                        select Item).ToList();

                }
                else
                {
                    Query.Append(String.Format(GlobalConstants.DYNAMIC_CAML_QUERY_GET_CHILD_NODE, spField.InternalName, RootNode));
                    objSPQuery.Query = Query.ToString();


                    objItems = objTaskList.GetItems(objSPQuery);
                    foreach (SPListItem objItem in objItems)
                    {
                        objNodeListItems.Add(objItem);
                    }

                }
                if (objNodeListItems != null && objNodeListItems.Count > 0)
                {
                    foreach (SPListItem objItem in objNodeListItems)
                    {
                        RootNode = Convert.ToString(objItem[GlobalConstants.LIST_COLUMN_TITLE]);
                        objKeyColumn = Convert.ToString(objItem[objTreeViewControlField.KeyColumn]);

                        objNodeTitle = Convert.ToString(objItem[objTreeViewControlField.ValueColumn]);
                        if (!String.IsNullOrEmpty(objNodeTitle))
                        {
                            TreeNode childNode = new TreeNode();
                            childNode.Text = objNodeTitle;
                            childNode.Value = objKeyColumn;
                            childNode.ExpandAll();

                            if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(childNode.Value))
                            {
                                childNode.ShowCheckBox = true;
                                childNode.Checked = true;
                            }
                            else if (this.ControlMode == SPControlMode.Display)
                            {
                                childNode.ShowCheckBox = false;
                            }
                            else
                            {
                                childNode.ShowCheckBox = true;
                            }

                            foreach (TreeNode cnode in GetChildNode(RootNode, valueArray, objListItemColn))
                            {
                                childNode.ChildNodes.Add(cnode);
                                cnode.SelectAction = TreeNodeSelectAction.None;
                                if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(cnode.Value))
                                {
                                    cnode.ShowCheckBox = true;
                                    cnode.Checked = true;
                                }
                                else if (this.ControlMode == SPControlMode.Display)
                                {
                                    cnode.ShowCheckBox = false;
                                }
                                else
                                {
                                    cnode.ShowCheckBox = true;
                                }
                            }
                            childtreenodes.Add(childNode);
                        }
                    }
                }
                return childtreenodes;
            }
            catch (Exception ex)
            {
                throw new Exception(GlobalConstants.ERROR_MESSAGE_CHILDNODE_CREATION_FAILED + GlobalConstants.HTML_BR + ex.Message);
            }
            // Call method again (recursion) to get the child items
//.........这里部分代码省略.........
开发者ID:mdimino514,项目名称:sharepoint-treeview-column,代码行数:101,代码来源:TreeViewFieldControl.ascx.cs

示例3: CompletaAlbero

        private void CompletaAlbero(TreeNodeCollection nodes, Business.Entity.Categorie categorie)
        {
            var numProd = AnnunciCategorieCollection.GetCount("IdCategorie == " + categorie.Id);

            //Prendo la categoria con la lingua di default
            var cat = Business.Entity.Categorie.GetItem(Business.Entity.Categorie.KeyColumnsEnum.Id, categorie.Id);
            TreeNode node = new TreeNode(cat.Nome + " (" + numProd + ")", cat.Id.ToString());
            if (NodiEspansi.Contains(cat.Id)) node.ExpandAll();

            foreach (var item in CategorieCollection.GetList(wherePredicate: "IdPrec == @0", whereValues: new object[] { categorie.Id }, orderPredicate: "Posizione ASC")) CompletaAlbero(node.ChildNodes, item);
            nodes.Add(node);
        }
开发者ID:bertasoft,项目名称:Network-Annunci,代码行数:12,代码来源:CategorieGenerali.aspx.cs

示例4: GetChildNode

        private TreeNodeCollection GetChildNode(string RootNode, string[] valueArray, List<SPListItem> objListItemColn)
        {
            TreeNodeCollection childtreenodes = new TreeNodeCollection();
            SPQuery objSPQuery;
            SPListItemCollection objItems = null;
            List<SPListItem> objNodeListItems = new List<SPListItem>();
            SiteMapNodeCollection objNode = new SiteMapNodeCollection();
            objSPQuery = new SPQuery();
            string objNodeTitle = string.Empty;
            string objLookupColumn = string.Empty;
            StringBuilder Query = new StringBuilder();
            SPList objTaskList;
            SPField spField;
            objTaskList = SPContext.Current.Web.Lists[objTreeViewControlField.ListName];
            objLookupColumn = objTreeViewControlField.ParentLookup;
            
            spField = SPContext.Current.Web.Lists[objTreeViewControlField.ListName].Fields[objTreeViewControlField.ParentLookup];
            if (this.ControlMode == SPControlMode.Display)
            {
                objNodeListItems = (from SPListItem Item in objListItemColn
                                    where (new SPFieldLookupValue(Convert.ToString(Item[objTreeViewControlField.ParentLookup])).LookupValue == RootNode)
                                    orderby Item.ID
                                    select Item).ToList();

            }
            else
            {
                Query.Append(String.Format("<Where><Eq><FieldRef Name='" + spField.InternalName + "' /><Value Type='LookupMulti'>{0}</Value></Eq></Where>", RootNode));
                objSPQuery.Query = Query.ToString();


                objItems = objTaskList.GetItems(objSPQuery);
                foreach (SPListItem objItem in objItems)
                {
                    objNodeListItems.Add(objItem);
                }

            }
            if (objNodeListItems != null && objNodeListItems.Count > 0)
            {
                foreach (SPListItem objItem in objNodeListItems)
                {
                    RootNode = Convert.ToString(objItem[GlobalConstants.LIST_COLUMN_TITLE]);
                    objNodeTitle = Convert.ToString(objItem[objTreeViewControlField.ValueColumn]);
                    if (!String.IsNullOrEmpty(objNodeTitle))
                    {
                        TreeNode childNode = new TreeNode();
                        childNode.Text = objNodeTitle;
                        childNode.Value = RootNode;
                        childNode.ExpandAll();

                        if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(childNode.Value))
                        {
                            childNode.ShowCheckBox = true;
                            childNode.Checked = true;
                        }
                        else if (this.ControlMode == SPControlMode.Display)
                        {
                            childNode.ShowCheckBox = false;
                        }
                        else
                        {
                            childNode.ShowCheckBox = true;
                        }




                        foreach (TreeNode cnode in GetChildNode(RootNode, valueArray, objListItemColn))
                        {
                            childNode.ChildNodes.Add(cnode);
                            cnode.SelectAction = TreeNodeSelectAction.None;
                            if (valueArray != null && this.ControlMode == SPControlMode.Edit && valueArray.Contains(cnode.Value))
                            {
                                cnode.ShowCheckBox = true;
                                cnode.Checked = true;
                            }
                            else if (this.ControlMode == SPControlMode.Display)
                            {
                                cnode.ShowCheckBox = false;
                            }
                            else
                            {
                                cnode.ShowCheckBox = true;
                            }
                        }

                        childtreenodes.Add(childNode);
                    }
                }

            }
            return childtreenodes;



            // Call method again (recursion) to get the child items



//.........这里部分代码省略.........
开发者ID:mdimino514,项目名称:sharepoint-treeview-column,代码行数:101,代码来源:TreeViewFieldControl.cs


注:本文中的System.Web.UI.WebControls.TreeNode.ExpandAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。