private void FindAndSelectItem(int id)
        {
            //first check if the item is not already in the Items collection
            foreach (var item in DebateList.Items)
            {
                if ((int)item.GetDataKeyValue("ID") == id)
                {
                    item.Selected = true;
                    return;
                }
            }

            //save the previously expanded indexes
            var expandedIndexes = new TreeListHierarchyIndex[DebateList.ExpandedIndexes.Count];

            DebateList.ExpandedIndexes.CopyTo(expandedIndexes);

            //add newly expanded indexes here
            var newIndexes = new List <TreeListHierarchyIndex>();

            //cause all items to expand to reveal all data
            DebateList.ExpandAllItems();

            //loop through all the items and search for the target by its key value
            foreach (var item in DebateList.Items)
            {
                if ((int)item.GetDataKeyValue("ID") == id)
                {
                    //select the item
                    item.Selected = true;

                    //expand all parents of the item
                    var parent = item.ParentItem;
                    while (parent != null)
                    {
                        newIndexes.Add(parent.HierarchyIndex);
                        parent = parent.ParentItem;
                    }
                }
            }

            //shrink back the treelist
            DebateList.CollapseAllItems();

            //restore the previously expanded indexes
            DebateList.ExpandedIndexes.AddRange(expandedIndexes);

            //add the newly expanded indexes that will reveal the selected item
            foreach (var index in newIndexes)
            {
                if (!DebateList.ExpandedIndexes.Contains(index))
                {
                    DebateList.ExpandedIndexes.Add(index);
                }
            }

            //rebind to reflect the changes
            DebateList.Rebind();
        }
 protected void expandLink_Click(Object sender, EventArgs e)
 {
     DebateList.ExpandAllItems();
 }