vs2005自带的treeview控件根节点无法收拢(没分了:()
看了点击+号执行的js函数,
根节点的js函数为TreeClose()
而下集节点的函数为TreeView_ToggleNode()
点根节点无任何反映
代码如下:
Tview_category.Nodes.Clear();
TreeNode TAll = new TreeNode( "全部 ", "-1 ");
Hashtable hashT = PoleSoft.CachedData.CategoryList;
Object[] array = new Object[hashT.Count];
int i = 0;
foreach (DictionaryEntry each in hashT)
{
//取所有一级分类
TreeNode tn = new TreeNode();
array[i++] = (FatherYellowPageCategory)each.Value;
FatherYellowPageCategory f = (FatherYellowPageCategory)each.Value;
tn.Text = f.Name;
tn.Value = f.id.ToString();
tn.ImageUrl = "/YellowPage/Images/top.bmp ";
ArrayList list = f.SubCategoryList;
//取一级分类下面的二级分类
for(int n = 0;n <list.Count;n++)
{
TreeNode tnChild = new TreeNode();
tnChild.Text = ((YellowPageCategory)list[n]).Name;
tnChild.Value = ((YellowPageCategory)list[n]).id.ToString();
tnChild.ImageUrl = "/YellowPage/Images/child.bmp ";
tn.ChildNodes.Add(tnChild);
}
TAll.ChildNode