private void DisplayHelpDesk() { bool RequestorR7_HelpDesk = (_DisplayType == "Administrator") ? false : true; HelpDeskTree colHelpDesk = new HelpDeskTree(PortalId, RequestorR7_HelpDesk); tvCategories.DataSource = colHelpDesk; TreeNodeBinding RootBinding = new TreeNodeBinding(); RootBinding.DataMember = "ListItem"; RootBinding.TextField = "Text"; RootBinding.ValueField = "Value"; tvCategories.DataBindings.Add(RootBinding); tvCategories.DataBind(); if (_Expand) { tvCategories.ExpandAll(); } }
// Tags #region DisplayHelpDesk private void DisplayHelpDesk() { HelpDeskTree colHelpDesk = new HelpDeskTree(PortalId, false); tvCategories.DataSource = colHelpDesk; TreeNodeBinding RootBinding = new TreeNodeBinding(); RootBinding.DataMember = "ListItem"; RootBinding.TextField = "Text"; RootBinding.ValueField = "Value"; tvCategories.DataBindings.Add(RootBinding); tvCategories.DataBind(); tvCategories.CollapseAll(); // If a node was selected previously select it again if (txtCategoryID.Text != "") { int intCategoryID = Convert.ToInt32(txtCategoryID.Text); TreeNode objTreeNode = (TreeNode)tvCategories.FindNode(GetNodePath(intCategoryID)); objTreeNode.Select(); objTreeNode.Expand(); // Expand it's parent nodes // Get the value of each parent node string[] strParentNodes = objTreeNode.ValuePath.Split(Convert.ToChar("/")); // Loop through each parent node for (int i = 0; i < objTreeNode.Depth; i++) { // Get the parent node TreeNode objParentTreeNode = (TreeNode)tvCategories.FindNode(GetNodePath(Convert.ToInt32(strParentNodes[i]))); // Expand the parent node objParentTreeNode.Expand(); } } else { //If there is at least one existing category, select it if (tvCategories.Nodes.Count > 0) { tvCategories.Nodes[0].Select(); txtCategoryID.Text = "0"; SelectTreeNode(); } else { // There is no data so set form to Add New SetFormToAddNew(); } } // If a node is selected, remove it from the BindDropDown drop-down int intCategoryNotToShow = -1; TreeNode objSelectedTreeNode = (TreeNode)tvCategories.SelectedNode; if (objSelectedTreeNode != null) { intCategoryNotToShow = Convert.ToInt32(tvCategories.SelectedNode.Value); } BindDropDown(intCategoryNotToShow); }