databind a DropDownList control with a list of all sub directories that exist in a particular direct
Posted
by sushant
on Stack Overflow
See other posts from Stack Overflow
or by sushant
Published on 2010-04-22T05:54:54Z
Indexed on
2010/04/22
6:13 UTC
Read the original article
Hit count: 207
vbscript
|asp-classic
I am wanting to databind a DropDownList control with a list of all sub directories that exist in a particular directory on the server. The directory I want to search is in the root of the application. I am fairly new to programming and I'm not sure where to even start.
I found this code on a website:
Dim root As String = "C;\"
Dim folders() As String = Directory.GetDirectories(root)
Dim sb As New StringBuilder(2048)
Dim f As String
For Each f In folders
Dim foldername As String = Path.GetFileName(f)
sb.Append("<option>")
sb.Append(foldername)
sb.Append("</option>")
Next
Label3.Text = "<select runat=""sever"" id=""folderlist""" & sb.ToString() & "</select>"
I guess this is vb. but my tool is in asp, so is their something similar in vbscript so that I can use it.
© Stack Overflow or respective owner