c# DropDownList 下拉框实现树形导航
2021-01-21 13:12
ddlbig.Items.Add(new ListItem("新闻分类", "0"));
newclass(pub.getpower(), "146", "");
public void newclass(DataTable dtMenu, string parentNo,string str)
{
string expression = "parentid= " + parentNo;
DataRow[] foundRows;
DataTable newdt = new DataTable();
foundRows = dtMenu.Select(expression);
str = str + " ";//实现树形
for (int i = 0; i
{
newdt.ImportRow((DataRow)foundRows[i]);
ddlbig.Items.Add(new ListItem(str + "|--" + foundRows[i]["menuname"].ToString(), foundRows[i]["No"].ToString()));
newclass(dtMenu, foundRows[i]["No"].ToString(), str);
}
}
上一篇:winform pdf浏览
下一篇:C# 递归产生树
文章标题:c# DropDownList 下拉框实现树形导航
文章链接:http://soscw.com/index.php/essay/45000.html