首页 > Web开发 > 详细

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

时间:2015-03-14 00:59:00      阅读:336      评论:0      收藏:0      [点我收藏+]

使用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

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

原文:http://www.cnblogs.com/sosoft/p/4336552.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!