日期:2014-05-18 浏览次数:21019 次
/// <summary> /// 添加树 /// </summary> /// <param name="ParentID"></param> /// <param name="pNode"></param> protected void AddTree(string ParentID, TreeNode pNode) { string FuncCode = string.Empty; string FuncName = string.Empty; string FuncURL = string.Empty; string FuncTarget = string.Empty; string nSonCount = string.Empty; DataView Dv = new DataView(m_Dt); Dv.RowFilter = " SubString(FuncCode,1,Len(FuncCode)-2) = '" + ParentID + "'"; foreach (DataRowView Row in Dv) { FuncCode = Row["FuncCode"].ToString(); FuncName = Row["FuncName"].ToString(); FuncURL = Row["FuncURL"].ToString();// FuncTarget = this.m_FuncTarget; nSonCount = Row["nSonCount"].ToString(); TreeNode Node = new TreeNode(); Node.SelectAction = TreeNodeSelectAction.Expand; if (FuncURL.IndexOf("?") < 3) FuncURL = FuncURL + "?1=1"; FuncURL = FuncURL + "&FuncCode=" + FuncCode + "&FuncName=" + Server.UrlEncode(FuncName); Node.Target = FuncTarget; Node.NavigateUrl = FuncURL; if (pNode == null) { Node.Text = FuncName; TreeView1.Nodes.Add(Node); if (int.Parse(nSonCount) > 0) AddTree(FuncCode, Node); } else { Node.Text = FuncName; pNode.ChildNodes.Add(Node); if (int.Parse(nSonCount) > 0) AddTree(FuncCode, Node); } } Dv = null; }