Home > Backend Development > C#.Net Tutorial > asp.net gets the name of the subdirectory under the site root directory

asp.net gets the name of the subdirectory under the site root directory

巴扎黑
Release: 2016-12-19 15:57:22
Original
2188 people have browsed it

Use Visual Studio to create an .aspx file (Web Forms), such as hovertree.aspx, and add a ListBox to the page
The code is as follows:

Html code

Then the code to display the root directory subfolder on the page is as follows:

C# code

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].S ubstring(m_subKeleyiFolder[i].LastIndexOf(" \") + 1);

}

lbKeleyiFolder.DataSource = m_subKeleyiFolder;

lbKeleyiFolder.DataBind();


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template