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);
    }
    }
    }

  • 相关阅读:
    scrapy框架
    selenium解析
    xpath解析
    解析语法
    request-html-render
    牛逼的requests-html
    Beautifulsoup
    请求和响应
    reuqests请求
    Django文件上传下载与富文本编辑框
  • 原文地址:https://www.cnblogs.com/sulong/p/5533751.html
Copyright © 2011-2022 走看看