一分心灵的宁静

在滚滚红尘,繁杂人世里,能够保持一分心灵的宁静,随时回到自己的内心深处,细细品味生命的奥妙,无疑是一种修身养性的人生境界

导航

N层树

Posted on 2006-02-11 14:57  有缘无份  阅读(162)  评论(0编辑  收藏  举报
可任意修改类别
 1private void BuildTree()
 2        {
 3            int i = 0;
 4            
 5            TreeNode oTNode = new TreeNode();
 6            oTNode.Type = "AddrTypes";
 7            oTNode.Text = SetLanguage();
 8            
 9            Hashtable tblNodes = new Hashtable();            ///build a list of Nodes, Key=ClassID, Value=Index
10            TreeNode oNode;
11            string sql = "NamespaceId = '" + ViewState["NamespaceId"].ToString() + "'";
12            string[] orderBy = {"AttributeCode""AttributeName"};
13            Z_NamespaceAttributeCollection oNamespaceAttributes = Z_NamespaceAttribute.LoadCollection(sql, orderBy, true);
14            
15            ///loop throught the Class table to build the Nodes and the List
16            TreeNode[] oNodes = new TreeNode[oNamespaceAttributes.Count];            ///build an array of Nodes to hold all AddrTypes
17            foreach (Z_NamespaceAttribute oNamespaceAttribute in oNamespaceAttributes)
18            {
19                oNode = new TreeNode();
20                oNode.Type = oNamespaceAttribute.AttributeId.ToString();
21                oNode.Text = oNamespaceAttribute.AttributeCode;
22                oNode.NavigateUrl = "QtNamespaceAttribute_PaneCenter.aspx?act=show&id=" + oNamespaceAttribute.AttributeId.ToString() + "&namespaceId=" + ViewState["NamespaceId"].ToString();
23                oNode.Target = "fraPaneCenter";
24                oNodes[i] = oNode;
25                tblNodes.Add(oNamespaceAttribute.AttributeId.ToString(), i);
26                ++i;
27            }

28            
29            ///loop throught the Class table again to put the Top Nodes into TreeView
30            foreach (Z_NamespaceAttribute oNamespaceAttribute in oNamespaceAttributes)
31            {
32                i = (int) tblNodes[oNamespaceAttribute.AttributeId.ToString()];
33
34                if (oNodes[i] != null) oTNode.Nodes.Add(oNodes[i]);
35            }

36            tvwNamespaceAttributeTree.Nodes.Add(oTNode);
37        }

没有字类别
 1private void BuildTree()
 2        {
 3            this.tvwTemplateTree.Nodes.Clear();
 4            int i = 0;
 5
 6            System.Web.UI.WebControls.TreeNode oTNode = new System.Web.UI.WebControls.TreeNode();
 7            oTNode.Value = "FG";
 8            oTNode.Text = "FG";
 9
10            Hashtable tblNodes = new Hashtable();            ///build a list of Nodes, Key=ClassID, Value=Index
11            System.Web.UI.WebControls.TreeNode oNode;
12            string[] orderBy = "CategoryCode" };
13            string sql = "ParentCategory = '" + GetParentCategory() +"'";
14            Z_CategoryCollection oCats = Z_Category.LoadCollection(sql, orderBy, true);
15
16            ///loop throught the Class table to build the Nodes and the List
17            System.Web.UI.WebControls.TreeNode[] oNodes = new System.Web.UI.WebControls.TreeNode[oCats.Count];            ///build an array of Nodes to hold all AddrTypes
18            foreach(Z_Category oCat in oCats)
19            {
20                oNode = new System.Web.UI.WebControls.TreeNode();
21                oNode.Value = oCat.CategoryID.ToString();
22                oNode.Text = oCat.CategoryName;
23                oNode.NavigateUrl = "CategoryFG_PaneCenter.aspx?act=showClass&id=" + oCat.CategoryID.ToString();
24                oNode.Target = "fraPaneCenter";
25                oNodes[i] = oNode;
26                tblNodes.Add(oCat.CategoryID.ToString(), i);
27                ++i;
28            }

29
30            ///loop throught the Class table again to put the Top Nodes into TreeView
31            foreach (Z_Category oCat in oCats)
32            {
33                i = (int)tblNodes[oCat.CategoryID.ToString()];
34
35                if (oNodes[i] != null) oTNode.ChildNodes.Add(oNodes[i]);
36            }

37
38            tvwTemplateTree.Nodes.Add(oTNode);
39        }