Click to See Complete Forum and Search --> : Populate Dropdown with filenames


lokiloki
January 5th, 2008, 07:47 PM
This code behind does not work and I can't figure out what is wrong:
I have Sysem.IO imported and the dropdownList on my ASP page.


Dim files() As String = Directory.GetFiles("C:\work", "*.*")


DropDownList1.DataSource = files
DropDownList1.DataBind()
End Sub

THX

marceln
January 5th, 2008, 07:54 PM
The data source must implement an IList.

Solution: add the elements from the files() array to an ArrayList object and set that as data source.