/// *******************************************************************************************************
 /// <summary>
 ///		Sets the Active Child to this Taxonomy Item
 /// </summary>
 /// <param name="child">TreeItem you want to be the child</param>
 /// *******************************************************************************************************
 public void SetChild(TaxonomyTreeItemControl child)
 {
     this.Controls.Clear();
     this.Controls.Add(child);
     this.child              = child;
     this.Child.IndentBase   = this.IndentBase;
     this.Child.BubbleEvents = this.BubbleEvents;
     this.Child.Click       += new TaxonomyTreeControlEventHandler(TaxonomyTreeItemControl_ChildClick);
 }
Example #2
0
        protected void PopulateTaxonomyTree( )
        {
            panelTaxonomyList.Visible    = false;
            panelCategoryChooser.Visible = true;

            int id = Convert.ToInt32(taxonomyID);

            taxonomyTree.TaxonomyID = id;
            taxonomyTree.KeyName    = taxonomyName;
            taxonomyTree.KeyValue   = "__r00t__";

            TaxonomyTreeItemControl item = null;



            if ("__r00t__" != keyValue && "" != keyValue)
            {
                string parent = keyValue;

                while (null != parent && "" != parent)
                {
                    if (null == item)
                    {
                        item = new TaxonomyTreeItemControl();
                    }
                    item.KeyValue = parent;
                    //replace this with a way to get the keyName with the taxonomyID and the taxonomyValue
                    item.KeyName    = Taxonomy.GetTaxonomyKeyName(id, parent);
                    item.TaxonomyID = id;
                    item.Click     += new TaxonomyTreeControlEventHandler(TaxonomyTreeControl_Click);
                    parent          = Taxonomy.GetTaxonomyParent(id, parent);
                    if ("" == parent)
                    {
                        break;
                    }
                    TaxonomyTreeItemControl parentitem = new TaxonomyTreeItemControl();;
                    parentitem.SetChild(item);
                    item = parentitem;
                }
            }
            if (null != item)
            {
                taxonomyTree.SetChild(item);
                taxonomyTree.SelectItem(item.Count);
            }
            else
            {
                taxonomyTree.SelectItem(0);
            }


            taxonomyTree.TaxonomyID = id;
            taxonomyTree.KeyName    = taxonomyName;
            taxonomyTree.KeyValue   = "__r00t__";
        }
        /// *******************************************************************************************************
        /// <summary>
        ///		Selects and Item in the Tree by the index of the item
        /// </summary>
        /// <param name="index">Index in the tree you want to be selected. Rendering will stop at this node</param>
        /// *******************************************************************************************************
        public void SelectItem(int index)
        {
            TaxonomyTreeItemControl item = this;

            while (item.Index != index)
            {
                item.isSelected = false;
                item            = item.Child;
            }
            item.isSelected    = true;
            this.selectedIndex = item.Index;
        }
 public TaxonomyTreeControlEventArgs(TaxonomyTreeItemControl item)
 {
     this.item = item;
 }