Home  >  Article  >  Backend Development  >  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

巴扎黑
巴扎黑Original
2016-12-19 15:57:222168browse

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();


Statement:
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
Previous article:.NET generic parsingNext article:.NET generic parsing