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 < foundRows.Length; 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);

     }

    

 }

 

转载于:https://blog.51cto.com/zhaoyingyatou/1596329

相关文章:

  • 2021-09-19
  • 2022-12-23
  • 2021-06-02
  • 2022-12-23
猜你喜欢
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
相关资源
相似解决方案