ASP.NET如何递归循环所有的分类呢??
private void ParseClassList() {
Response.Write(LoopClass(0)); // 只输出第一类的。子类都没有输出来? 如果循环呢??
}
private string LoopClass(int classid)
{
StringBuilder classlist = new StringBuilder();
ArticleClassAccesser classAccesser = new ArticleClassAccesser(this.LshopAdminDbAccesser);
ArticleClassSearchKeyword keyword = new ArticleClassSearchKeyword();
keyword.ParentID = classid;
DataElementCollection<ArticleClass> list = classAccesser.List(0, keyword);
if (list != null)
{
foreach (ArticleClass aclass in list)
{
classlist = classlist.Append("<tr>");
classlist = classlist.Append(" <td style=\"width:30px;\"><input type=\"checkbox\" name=\"ids\" value=\"" + aclass.ClassID + "\"/></td>");
classlist = classlist.Append(" <td>" + aclass.ClassID + "</td>");
classlist = classlist.Append(" <td>" + aclass.ClassName + "</td>");
classlist = classlist.Append(" <td>" + aclass.OrderID + "</td>");
classlist = classlist.Append(" <td>" + aclass.ParentPath + "</td>");
classlist = classlist.Append(" <td style=\"width:150px;\"><a href=\"ArticleClassInfo.aspx?id=<$:ArticleClassList.Id>\" title=\"修改记录\">修改</a></td>");
classlist = classlist.Append("</tr>");
LoopClass(aclass.ClassID); 这里好像不起作用哦,
}
}
return classlist.ToString();
}