System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo("X:\\File\\Path\\");
  System.IO.FileInfo[] files = dirInfo.GetFiles("*.ext");

  yourDropDownList.DataSource = files;

OR we can do it the old fashioned way:

foreach (FileInfo file in files)  {
   yourDropDownList.Items.Add(new ListItem(file.Name));  

Leave a Reply.

    About the author

    The author have 12+ years experience in IT Industry with varying job roles from system developer/analyst/consultant positions. Majority of her development, implementation and systems support background focus on Financial/Banking/Credit Solutions.


    November 2010
    October 2010



    RSS Feed