首页 > 学院 > 开发设计 > 正文

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

2019-11-17 02:01:42
字体:
来源:转载
供稿:网友

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.VEVb.com/sosoft/p/kaifajishu.html


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表