zoukankan      html  css  js  c++  java
  • 无限级分类

     1   /// <summary>  
     2         /// 控件绑定父节点 
     3         /// </summary>  
     4         string lianjie = "";
     5         public string TreeViewBind()
     6         {
     7             DataTable dt = YHDAL.SelectChaXunQuanBuYongHu();
     8             DataView dv = dt.DefaultView;
     9             dv.RowFilter = "FuId=0";   //筛选FuId=0为顶级分类
    10             int id = 0;
    11             string zhongwenming = "";
    12             string bumen = "";
    13             int JBie = 0;
    14             foreach (DataRowView drv in dv)
    15             {
    16                 id = int.Parse(drv["id"].ToString());
    17                 JBie = int.Parse(drv["JiBie"].ToString());
    18                 zhongwenming = drv["ZhongWenMing"].ToString();
    19                 bumen = drv["BuMenMingChen"].ToString();
    20                 lianjie += "<div CLASS='JiBie"+JBie+"'>(id:" + id + ")" + bumen + "<a  href='YongHuZhuCe.aspx?F=" + id + "'>" + zhongwenming + "</a><a href='YongHuZhuCe.aspx?YHID=" + id + "&LX=1'>修改</a><a href='YongHuZhuCe.aspx?YHID=" + id + "&LX=2'>删除</a></div>";
    21                 AddReplies(dv, id);
    22             }
    23             dt.Clear();
    24             return lianjie;
    25         }
    26 
    27         /// <summary>  
    28         /// 递归绑定子节点  
    29         /// </summary>  
    30         /// <param name="dv"></param>  
    31         /// <param name="node"></param>  
    32         public void AddReplies(DataView dv, int node)
    33         {
    34             dv.RowFilter = "FuId='" + node + "'";
    35             int id = 0;
    36             string zhongwenming = "";
    37             string bumen = "";
    38             int JBie = 0;
    39             foreach (DataRowView row in dv)
    40             {
    41 
    42                 JBie = int.Parse(row["JiBie"].ToString());
    43                 id = int.Parse(row["id"].ToString());
    44                 zhongwenming = row["ZhongWenMing"].ToString();
    45                 bumen = row["BuMenMingChen"].ToString();
    46                 lianjie += "<div CLASS='JiBie" +JBie+ "'>(id:" + id + ")" + bumen + "<a  href='YongHuZhuCe.aspx?F=" + id + "'>" + zhongwenming + "</a><a href='YongHuZhuCe.aspx?YHID=" + id + "&LX=1'>修改</a><a href='YongHuZhuCe.aspx?YHID=" + id + "&LX=2'>删除</a></div></br>";
    47                 AddReplies(dv, id);
    48             }
    49         }
  • 相关阅读:
    编写高质量代码 :Web前端开发修炼之道(读书笔记)
    Cordova开发学习笔记
    C++面试总结
    深信服社招Linux岗位一面记录
    一次软件开发不问技术的面试
    面试总结2
    剑指offer 学习笔记(一):二维数组中的查找
    关于思维习惯问题
    ajax的使用(使用json格式提交给服务端)
    es6-13 类与对象
  • 原文地址:https://www.cnblogs.com/a1235202005/p/2671646.html
Copyright © 2011-2022 走看看