zoukankan      html  css  js  c++  java
  • 加载出一个有层次的下拉框

    public void getOneClassTree(int classid, System.Web.UI.WebControls.DropDownList cid, int _depth = 0)
    {
    string texts = "";
    string values = "";
    int depth = _depth;
    BLL.manager_Department BLL_商品 = new BLL.manager_Department();
    Model.manager_Department cate = new Model.manager_Department();
    //获取商品类别对象
    cate = BLL_商品.GetModel(classid);
    DataTable dt_Have = SqlHelpers.GetDataTableBySQL("select * from manager_Department where parent_id=" + classid + " order by parent_id");
    for (int i = 0; i < depth; i++)
    {
    texts += " ";
    }
    values = cate.id.ToString();
    if (dt_Have.Rows.Count == 0)
    {
    texts += " - " + cate.dep_name;
    cid.Items.Add(new ListItem(texts, values));
    }
    else
    {
    texts += " + " + cate.dep_name;
    cid.Items.Add(new ListItem(texts, values));
    DataTable classidArry1 = SqlHelpers.GetDataTableBySQL("select * from manager_Department where parent_id=" + classid + " order by parent_id");
    foreach (DataRow dr in classidArry1.Rows)
    {
    getOneClassTree(Convert.ToInt32(dr["id"]), cid, depth + 1);
    }
    }
    }

  • 相关阅读:
    软件设计中的立足点
    Clojure基础
    团队凝聚力
    执行力与领导力
    工作与生活
    分离焦虑OR责任焦虑
    保持激情
    立足点
    论研发管理--开篇
    初级码农常犯错误
  • 原文地址:https://www.cnblogs.com/sulong/p/5533751.html
Copyright © 2011-2022 走看看