当前位置: 移动技术网 > IT编程>开发语言>.net > asp.net 无限分类第1/3页

asp.net 无限分类第1/3页

2018年04月22日  | 移动技术网IT编程  | 我要评论

nba2k13秒退,闪志强,薄膜滤菌器

1、递归函数

//  '递归遍历自建目录树=============================================================================

  private void showdir(string szml,string sindex)
  {
   system.data.sqlclient.sqlconnection sqlcon=new system.data.sqlclient.sqlconnection(connectionstring);
   string sqlstr="select * from mltable where mlzml=n'"+ szml +"'";
   system.data.sqlclient.sqldataadapter sqlada=new system.data.sqlclient.sqldataadapter(sqlstr,sqlcon);
   system.data.datatable dt=new datatable();
   sqlada.fill(dt);
   microsoft.web.ui.webcontrols.treenode node1;
   string sindex0;
   string sindex2;
   int theid;

   int sindex1=0;//记录树的最后一位值
   foreach(system.data.datarow dtdatarow in dt.rows)
   {
    theid=convert.toint32(dtdatarow["mlid"]);
    node1=new microsoft.web.ui.webcontrols.treenode();
    node1.text=dtdatarow["mlmc"].tostring();
    node1.imageurl="images/trees/folder.gif";
    node1.expandedimageurl="images/trees/folderopen.gif";
    node1.expanded=false;
    node1.navigateurl="admin_tree_show.aspx?theid=" + theid +"&sindex="+ sindex+"."+sindex1.tostring();
    node1.id="";
    node1.target="main";
    if(sindex=="")
    {
     sindex2=treeview1.nodes.indexof(node1).tostring();
     sindex0=sindex2;

    }
    else
    {

     microsoft.web.ui.webcontrols.treenode pnode=treeview1.getnodefromindex(sindex);
     pnode.nodes.add(node1);
     sindex2=pnode.nodes.indexof(node1).tostring();
     sindex0=sindex + "." + sindex2;
     sindex1++;//记录当前树下叶子的个数,即当前叶子的号
    }
    showdir(dtdatarow["mlid"].tostring(),sindex0);

   
   }
   sqlcon.close();

  }

1

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网