DrpList

 private void ShowFolderList()
    {
        drpLegalType1.Items.Clear();
        string LegalTypeName=string.Empty;   

        DataSet ds = FieldType.GetList("t0025");//案件性质类别
        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
        {
            LegalTypeName = ds.Tables[0].Rows[i]["TypeName"].ToString();
            this.drpLegalType1.Items.Add(new ListItem(LegalTypeName, LegalTypeName));
            addChildFolder(LegalTypeName);
        }
    }

    private void addChildFolder(string parentID)
    {
        string folder = string.Empty;
        string LegalTypeName = string.Empty;
        DataSet ds = FieldType.GetList2(parentID);

        if (ds.Tables[0].Rows.Count != 0)
        {          
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                LegalTypeName = ds.Tables[0].Rows[i]["TypeName"].ToString();
                folder = "   ├" + LegalTypeName;            
                this.drpLegalType1.Items.Add(new ListItem(folder, LegalTypeName));
            }
        }
    }
---------------------------------------------------------------------------------

private void ShowFolderList()
  { 
   drpDep.Items.Clear();
   this.drpDep.Items.Add(new ListItem("--选择学院名称--","00"));
   string str="";
    str="select SD_ID,SD_NAME from SYS_DEPARTMENT where   SD_PARENTID=0";
   DataSet ds=sql.GetDataSet(str);
   for(int i=0;i<ds.Tables[0].Rows.Count;i++)
   {    
    int intSRSID = (int)ds.Tables[0].Rows[i]["SD_ID"];
    string folder = ds.Tables[0].Rows[i]["SD_NAME"].ToString();
    this.drpDep.Items.Add(new ListItem(folder,intSRSID.ToString()));               
    addChildFolder(intSRSID,1);
   }
  }

  private void addChildFolder(int parentID,int layer)
  {   
   string str="";   
   str="select SD_ID,SD_NAME from SYS_DEPARTMENT where   SD_PARENTID='"+parentID+"'order by SD_PARENTID asc";   
   DataSet ds=sql.GetDataSet(str);   
   if(ds.Tables[0].Rows.Count!=0)
   {
    layer++;
    for(int i=0;i<ds.Tables[0].Rows.Count;i++)
    {
     int intSRSID = (int)ds.Tables[0].Rows[i]["SD_ID"];
     string folder = "├"+ds.Tables[0].Rows[i]["SD_NAME"].ToString();
     for(int j=0;j<layer-1;j++)
     {
      folder =" "+folder;
     }
     this.drpDep.Items.Add(new ListItem(folder,intSRSID.ToString()));    
     if(IsParentID(intSRSID))
      addChildFolder(intSRSID,layer);   
     
    } 
   }
  }
  private bool IsParentID(int ParentID)
  {
   string str="select SD_ID,SD_NAME from SYS_DEPARTMENT where   SD_PARENTID='"+ParentID+"'";
   DataSet ds=sql.GetDataSet(str);
   if(ds!=null)
   {
    if(ds.Tables[0].Rows.Count!=0)
     return true;
    else
     return false;
   }
   else
    return false;
  }

posted on 2007-10-18 11:23  敌后武工队  阅读(147)  评论(0编辑  收藏  举报