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


C# TreeNode.ToggleExpandState方法代码示例

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


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

示例1: BuildCodexMenu

    /// <summary>
    /// Recursively adds nodes to the treeview menu starting at a given set of peers of a parent node.
    /// </summary>
    /// <param name="nodes">The root treenode collection to which to add child cnodes</param>
    /// <param name="parentCodexRecordId">The parent node record's ID, used to fetch the children</param>
    private void BuildCodexMenu( TreeNodeCollection nodes, int parentCodexRecordId )
    {
        CodexRecordList list = parentCodexRecordId > 0 ? CodexRecordList.GetCodexRecordList( parentCodexRecordId ) : CodexRecordList.GetCodexRecordList();

        //no child nodes (parent will always be included), exit function
        if ( list.Count < 2 ) return;

        foreach ( CodexRecord record in list )
        {
            if ( record.ID == parentCodexRecordId || ( parentCodexRecordId == 0 && record.ParentCodexRecordID != 0 ) ) continue;

            TreeNode node = new TreeNode( record.Title, record.ID.ToString() );

            // automatically select the first root node
            if ( record.ParentCodexRecordID == 0 && CodexMenu.SelectedNode == null ) node.Select();

            nodes.Add( node );
            node.ToggleExpandState();

            BuildCodexMenu( node.ChildNodes, record.ID );
        }
    }
开发者ID:TertiumQuid,项目名称:Aphelion-Trigger,代码行数:27,代码来源:Index.aspx.cs

示例2: BuildChildNodes

            private void BuildChildNodes(TreeNodeCollection nodes, DataView DtView, string filter, bool ThreadViewPermission)
            {
                //string href = ATC.Tools.GetParam("RootURL") + "?page=" + ATC.Tools.URLParam("page") + "&Thread=" + ATC.Tools.URLParam("Thread");

                string rURL = RequestUrl.Url.OriginalString;
                //string href = "#";//rURL.Substring(0, RequestUrl.Url.AbsoluteUri.IndexOf("Thread") + 10) + ATC.Tools.URLParam("Thread");

                if (DtView.Count > 0)
                {
                    DtView.RowFilter = filter;
                    int RowCounter = 0;

                    string sFieldName = string.Empty;
                    string sId = string.Empty;
                    string sParentId = string.Empty;
                    string sMessage = string.Empty;
                    string sImageUrl = string.Empty;
                    string state = string.Empty;

                    for (RowCounter = 0; RowCounter <= DtView.Count - 1; RowCounter++)
                    {
                        TreeNode tn = new TreeNode();
                        sFieldName = DtView[RowCounter]["Subject"].ToString() + " " + state;
                        sId = DtView[RowCounter]["ID"].ToString();
                        sParentId = DtView[RowCounter]["ParentID"].ToString();
                        sMessage = DtView[RowCounter]["Message"].ToString();
                        sImageUrl = DtView[RowCounter]["PostType"].ToString();
                        sImageUrl = getImageIconUrl(sImageUrl);

                        tn.Text = sFieldName;
                        tn.Value = sId;
                        tn.ToolTip = sMessage;
                        tn.ImageUrl = sImageUrl;
                        tn.SelectAction = TreeNodeSelectAction.None;

                        nodes.Add(tn);
                        tn.ToggleExpandState();

                        DataView vuData2 = new DataView(Data.Tables[0]);
                        if (DtView.Count > RowCounter)
                        {
                            BuildChildNodes(tn.ChildNodes, vuData2, ChildColumn + " = " + DtView[RowCounter][ParentColumn], ThreadViewPermission);
                        }
                    }
                }
            }
开发者ID:puzzledbypolicy,项目名称:uDebate,代码行数:46,代码来源:ThreadsPostsPrintTreeView.aspx.cs

示例3: HandleExpandCollapseEvent

		void HandleExpandCollapseEvent (TreeNode node)
		{
			node.ToggleExpandState ();
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:4,代码来源:TreeView.cs

示例4: GetNodeForCompanyLevels

        private void GetNodeForCompanyLevels(TreeNodeCollection nodes, int parentId, int companyLevelId)
        {
            Int32 thisId;
            string thisName;

            DataRow[] children = companyLevelsTDS.Tables["LFS_FM_COMPANYLEVEL"].Select("ParentID='" + parentId + "'");

            //no child nodes, exit function
            if (children.Length == 0) return;

            foreach (DataRow child in children)
            {
                // step 1
                thisId = Convert.ToInt32(child.ItemArray[0]);

                // step 2
                thisName = Convert.ToString(child.ItemArray[1]);

                // step 3
                TreeNode newNode = new TreeNode(thisName, thisId.ToString());
                newNode.ShowCheckBox = true;
                newNode.SelectAction = TreeNodeSelectAction.None;

                //step 4
                if (companyLevelId == thisId)
                {
                    newNode.Checked = true;
                }

                // step 5
                nodes.Add(newNode);
                newNode.ToggleExpandState();

                // step 6
                GetNodeForCompanyLevels(newNode.ChildNodes, thisId, companyLevelId);
            }
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:37,代码来源:units_summary.aspx.cs

示例5: GetNodeForCategory

        private void GetNodeForCategory(TreeNodeCollection nodes, int parentId)
        {
            Int32 thisId;
            String thisName;
            UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway(null);

            DataRow[] children = categoriesTDS.Tables["LFS_FM_CATEGORY"].Select("ParentID='" + parentId + "'");

            //no child nodes, exit function
            if (children.Length == 0) return;

            foreach (DataRow child in children)
            {
                // step 1
                thisId = Convert.ToInt32(child.ItemArray[0]);

                // step 2
                thisName = Convert.ToString(child.ItemArray[2]);

                // step 3
                TreeNode newNode = new TreeNode(thisName, thisId.ToString());
                newNode.ShowCheckBox = true;
                newNode.SelectAction = TreeNodeSelectAction.None;

                //step 4
                if (unitsCategoryGateway.IsUsedInUnitCategory(Int32.Parse(hdfUnitId.Value), thisId))
                {
                    newNode.Checked = true;
                }

                // step 5
                nodes.Add(newNode);
                newNode.ToggleExpandState();

                // step 6
                GetNodeForCategory(newNode.ChildNodes, thisId);
            }
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:38,代码来源:units_summary.aspx.cs

示例6: GetNodeForCategory

        // ////////////////////////////////////////////////////////////////////////
        // FINAL METHODS
        //
        private void GetNodeForCategory(TreeNodeCollection nodes, int parentId)
        {
            Int32 thisId;
            String thisName;

            DataRow[] children = categoriesTDS.Tables["LFS_FM_CATEGORY"].Select("ParentID='" + parentId + "'");

            // No child nodes, exit function
            if (children.Length == 0) return;

            foreach (DataRow child in children)
            {
                // Step 1
                thisId = Convert.ToInt32(child.ItemArray[0]);

                // Step 2
                thisName = Convert.ToString(child.ItemArray[2]);

                // Step 3
                TreeNode newNode = new TreeNode(thisName, thisId.ToString());
                newNode.ShowCheckBox = true;
                newNode.SelectAction = TreeNodeSelectAction.None;

                // Step 4
                nodes.Add(newNode);
                newNode.ToggleExpandState();

                // Step 5
                GetNodeForCategory(newNode.ChildNodes, thisId);
            }
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:34,代码来源:units_add.aspx.cs

示例7: StepGeneralInformationIn

        // ////////////////////////////////////////////////////////////////////////
        // STEP1 - GENERAL INFORMATION - METHODS
        //
        private void StepGeneralInformationIn()
        {
            // Set instruction
            Label instruction = (Label)this.Master.FindControl("lblInstruction");
            instruction.Text = "Please provide general information";

            if (rbtnBeginTemplate.Checked)
            {
                int costingSheetTemplateId = Int32.Parse(hdfSelectedIdTemplate.Value);

                if (costingSheetTemplateId != 0)
                {
                    // Prepare initial data
                    // ... for template
                    foreach (ProjectCostingSheetAddTDS.TemplateInformationRow row in (ProjectCostingSheetAddTDS.TemplateInformationDataTable)Session["templateInformation"])
                    {
                        if (row.CostingSheetTemplateID == costingSheetTemplateId)
                        {
                            tbxName.Text = row.Name;

                            cbxRehabAssessmentData.Checked = row.RAData;
                            cbxFullLengthLiningData.Checked = row.FLLData;
                            cbxPointRepairData.Checked = row.PRData; ;
                            cbxJunctionLiningData.Checked = row.JLData;
                            cbxManholeRehabData.Checked = row.MRData;
                            cbxMobilizationData.Checked = row.MOBData;
                            cbxOtherData.Checked = row.OtherData;

                            cbxLabourHour.Checked = row.LabourHourData;
                            cbxTrucksEquipment.Checked = row.UnitData;
                            cbxMaterial.Checked = row.MaterialData;
                            cbxSubcontractor.Checked = row.SubcontractorData;
                            cbxOtherCost.Checked = row.MiscData;

                            cbxRevenueInformation.Checked = row.RevenueIncluded;

                            luEndSaveTemplate.SelectedValue = row.CostingSheetTemplateID.ToString();

                            try
                            {
                                DateTime startDate = new DateTime(row.Year, row.Month, row.Day);
                                tkrdpFrom.SelectedDate = startDate;
                            }
                            catch { }

                            try
                            {
                                DateTime endDate = new DateTime(row.Year2, row.Month2, row.Day2);
                                tkrdpTo.SelectedDate = endDate;
                            }
                            catch { }
                        }
                    }
                }

                //foreach (ProjectTDS.LFS_PROJECTRow row in (ProjectTDS.LFS_PROJECTDataTable)project.Table)
                //{
                //    // step 1
                //    thisId = Convert.ToInt32(row[0].ToString());

                //    // step 2
                //    thisName = Convert.ToString(row[8].ToString());

                //    // step 3
                //    TreeNode newNode = new TreeNode(thisName, thisId.ToString());
                //    newNode.ShowCheckBox = true;
                //    newNode.SelectAction = TreeNodeSelectAction.None;

                //    // step 4
                //    nodes.Add(newNode);
                //    newNode.ToggleExpandState();
                //}
            }

            Int32 thisId;
            String thisName;
            TreeNodeCollection nodes;

            CompaniesGateway companies = new CompaniesGateway();
            companies.LoadByCompaniesId(int.Parse(hdfClientId.Value), int.Parse(hdfCompanyId.Value));
            string nameCompany = companies.GetName(int.Parse(hdfClientId.Value));

            ProjectGateway project = new ProjectGateway();
            project.LoadByClientId(int.Parse(hdfClientId.Value));

            TreeNode tnParent = new TreeNode();
            tnParent.Text = nameCompany;
            tnParent.Value = "0";
            tnParent.ShowCheckBox = true;
            tnParent.SelectAction = TreeNodeSelectAction.None;

            tvProjectsRoot.Nodes.Add(tnParent);
            tnParent.ToggleExpandState();

            PopulateNodes(project.Table, tnParent.ChildNodes);
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:99,代码来源:project_combined_costing_sheets_add.aspx.cs

示例8: BuildChildNodes

            private void BuildChildNodes(TreeNodeCollection nodes, DataView DtView, string filter, bool ThreadViewPermission, Panel StartingPanel, HtmlTable ForumsTable)
            {
                //string href = ATC.Tools.GetParam("RootURL") + "?page=" + ATC.Tools.URLParam("page") + "&Thread=" + ATC.Tools.URLParam("Thread");

                string rURL = RequestUrl.Url.OriginalString;
                string href = rURL.Substring(0, RequestUrl.Url.AbsoluteUri.IndexOf("Thread") + 10) + ATC.Tools.URLParam("Thread");

                if (DtView.Count > 0)
                {
                    DtView.RowFilter = filter;
                    int RowCounter = 0;

                    string sFieldName = string.Empty;
                    string sId = string.Empty;
                    string sParentId = string.Empty;
                    string sMessage = string.Empty;
                    string sImageUrl = string.Empty;
                    string state = string.Empty;

                    int iCount = 0;

                    for (RowCounter = 0; RowCounter <= DtView.Count - 1; RowCounter++)
                    {
                        TreeNode tn = new TreeNode();

                        if (ThreadViewPermission)
                        {
                            /* if post is published admins can unpublish or delete */
                            if (DtView[RowCounter]["IsPublished"].ToString() == "1")
                            {
                                state = "<span class='forum_link'><a href='"
                                      + href + "&PostAction=Reject&Post=" + DtView[RowCounter]["ID"].ToString()
                                      + "' class='admin_link'>Unpublish</a></span>&nbsp;-&nbsp;<span class='forum_link'><a href='"
                                      + href + "&PostAction=Delete&Post="
                                      + DtView[RowCounter]["ID"].ToString() + "' class='admin_link'>Delete</a></span>&nbsp;";
                            }
                            else // Post unpublished
                            {
                                state = "<span class='forum_link'><a href='"
                                      + href + "&PostAction=Accept&Post=" + DtView[RowCounter]["ID"].ToString()
                                      +  "' class='admin_link'>Re-publish</a></span>&nbsp;|&nbsp;<span class='forum_link'><a href='"
                                      + href + "&PostAction=Delete&Post="
                                      + DtView[RowCounter]["ID"].ToString() + "' class='admin_link'>Delete</a></span>&nbsp;";
                            }
                        }
                        sFieldName = DtView[RowCounter]["Subject"].ToString() + " " + state;
                        sId = DtView[RowCounter]["ID"].ToString();
                        sParentId = DtView[RowCounter]["ParentID"].ToString();
                        sMessage = DtView[RowCounter]["Message"].ToString();
                        sImageUrl = DtView[RowCounter]["PostType"].ToString();
                        sImageUrl = getImageIconUrl(sImageUrl);

                        tn.Text = sFieldName;
                        tn.Value = sId;

                        //tn.ToolTip = sMessage;
                        tn.ImageUrl = sImageUrl;

                        nodes.Add(tn);
                        tn.ToggleExpandState();

                        DataView vuData2 = new DataView(Data.Tables[0]);
                        if (DtView.Count > RowCounter)
                        {
                            BuildChildNodes(tn.ChildNodes, vuData2, ChildColumn + " = " +
                                DtView[RowCounter][ParentColumn], ThreadViewPermission, StartingPanel, ForumsTable);
                        }
                    }
                }
            }
开发者ID:puzzledbypolicy,项目名称:uDebate,代码行数:70,代码来源:ThreadsPostsTreeView.ascx.cs

示例9: GetNodeForCompanyLevels

        private void GetNodeForCompanyLevels(TreeNodeCollection nodes, int parentId)
        {
            Int32 thisId;
            string thisName;
            RuleCompanyLevelGateway ruleCompanyLevelGateway = new RuleCompanyLevelGateway(null);

            DataRow[] children = companyLevelsTDS.Tables["LFS_FM_COMPANYLEVEL"].Select("ParentID='" + parentId + "'");

            // No child nodes, exit function
            if (children.Length == 0) return;

            foreach (DataRow child in children)
            {
                // Step 1
                thisId = Convert.ToInt32(child.ItemArray[0]);

                // Step 2
                thisName = Convert.ToString(child.ItemArray[1]);

                // Step 3
                TreeNode newNode = new TreeNode(thisName, thisId.ToString());
                newNode.ShowCheckBox = true;
                newNode.SelectAction = TreeNodeSelectAction.None;

                // Step 4
                if (ruleCompanyLevelGateway.IsUsedInRuleCompanyLevel(Int32.Parse(hdfRuleId.Value), thisId))
                {
                    newNode.Checked = true;
                    arrayCompanyLevelsSelected.Add(int.Parse(newNode.Value));
                }

                // Step 5
                nodes.Add(newNode);
                newNode.ToggleExpandState();

                // Step 6
                GetNodeForCompanyLevels(newNode.ChildNodes, thisId);
            }
        }
开发者ID:NosDeployer,项目名称:TestBranching,代码行数:39,代码来源:checklist_rules_summary.aspx.cs

示例10: TreeNode_ToggleExpandState

		public void TreeNode_ToggleExpandState ()
		{
			TreeNode node = new TreeNode ("node");
			Assert.AreEqual (null, node.Expanded, "TreeNode_ToggleExpandState#1");
			node.ToggleExpandState ();
			Assert.AreEqual (true, node.Expanded, "TreeNode_ToggleExpandState#2");
			node.ToggleExpandState ();
			Assert.AreEqual (false, node.Expanded, "TreeNode_ToggleExpandState#3");
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:TreeNodeTest.cs


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