Home Account Search

How to get folder names from server?

To databind a DropDownList control with a list of all sub directories that exist in a particular directory on the server please use code below.

string[] folders = System.IO.Directory.GetDirectories(@"C:\");

DropDownList1.DataSource = folders;

DropDownList1.DataBind();

Comments are locked for this post.