乐逍遥

博客园 首页 新随笔 联系 订阅 管理

    private void BindDataToTree(TreeNodeCollection tns, string id, DataTable dt)
    {

        DataView dv = dt.DefaultView;
        dv.RowFilter = "upNo=" + id;
        TreeNode tn;
        string strID;
        foreach (DataRowView dr in dv)
        {
            strID = dr["no"].ToString();
            if (strID != "")
            {
                tn = new TreeNode();
                tn.Value = dr["no"].ToString();
                tn.Text = dr["Name"].ToString();
                tn.ImageUrl = "../images/Folder.gif";
                tns.Add(tn);
                BindDataToTree(tns[tns.Count - 1].ChildNodes, strID, dt);
            }
        }
    }

posted on 2007-12-04 17:41  乐逍遥  阅读(469)  评论(0编辑  收藏  举报