·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> asp.net获取站点根目录下子目录的名称

asp.net获取站点根目录下子目录的名称

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23

asp.net获取站点根目录下子目录的名称

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

<asp:ListBox runat="server" ID="lbKeleyiFolder" />

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

string[] m_subKeleyiFolder = Directory.GetDirectories(Server.MapPath("/hvtimg\\"));int m_countHovertree = m_subKeleyiFolder.Length;for (int i = 0; i < m_countHovertree; i++){m_subKeleyiFolder[i] = m_subKeleyiFolder[i].Substring(m_subKeleyiFolder[i].LastIndexOf("\\") + 1);}lbKeleyiFolder.DataSource = m_subKeleyiFolder;lbKeleyiFolder.DataBind();

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

http://www.cnblogs.com/sosoft/p/kaifajishu.html