无限级分类根据ClassId列出下级ClassId,并以","分割

        public string GetListClassstr(int ClassId)
        {
            DataTable DT = new DataTable();
            DT = (DataTable)GetClassCache();//返回一个表内容 这个要修改自己的
            string ClassStr = ClassId.ToString();
            for (int i = 0; i < DT.Rows.Count; i++)
            {
                if (ClassId == (int)DT.Rows[i]["ParentId"])
                {
                    ClassStr += "," + DT.Rows[i]["Id"];
                }
            }
            return ClassStr;
        }
posted @ 2008-09-05 14:57  郑希强  阅读(224)  评论(0编辑  收藏  举报