Filelist -> Droplist?

  • Thread starter Thread starter Lasse Edsvik
  • Start date Start date
L

Lasse Edsvik

Hello

I was wondering if you guys could show me how to fill a droplist with files
from a directory?

I got this but dont work

DirectoryInfo dir = new DirectoryInfo(Server.MapPath("img/"));

DropDown1.DataSource = dir.GetFiles(dir);

DropDown1.DataBind();
 
Hi Edsvik,
make DataSource = dir.GetFiles() instead of dir.GetFiles(dir) and see that
the img folder has some files.

DirectoryInfo dir = new DirectoryInfo(Server.MapPath("img/"));
DropDown1.DataSource = dir.GetFiles();
DropDown1.DataBind();

HTH
srini
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top