使用Visual Studio建立一个.aspx文件(Web Forms),例如hovertree.aspx,在页面上加入一个ListBox
代码如下:

Html代码  asp.net获取站点根目录下子目录的名称
  1. <asp:ListBox runat="server" ID="lbKeleyiFolder" />  

 

那么在页面上显示根目录子文件夹的代码如下:

C#代码  asp.net获取站点根目录下子目录的名称
  1. string[] m_subKeleyiFolder = Directory.GetDirectories(Server.MapPath("/hvtimg\\"));  
  2.   
  3. int m_countHovertree = m_subKeleyiFolder.Length;  
  4. for (int i = 0; i < m_countHovertree; i++)  
  5. {  
  6. m_subKeleyiFolder[i] = m_subKeleyiFolder[i].Substring(m_subKeleyiFolder[i].LastIndexOf("\\") + 1);  
  7. }  
  8.   
  9. lbKeleyiFolder.DataSource = m_subKeleyiFolder;  
  10. lbKeleyiFolder.DataBind();  

 

HoverTree系统源码下载http://hovertree.codeplex.com/

相关文章:

  • 2022-12-23
  • 2022-02-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2021-12-08
  • 2021-11-22
相关资源
相似解决方案