Gridview - how get files in a dir for a ddl

V

VB Programmer

I have a dropdownlist which shows up in "edit" mode for a gridview.

I want the dropdownlist to display a list of files in a certain dir.

How do i do this?

This doesn't seem to be working....

Dim lb As DropDownList = CType(Me.GridView1.FindControl("ddlFiles"),
DropDownList)
lb.Items.Clear()

Dim f As String()
f = System.IO.Directory.GetFiles(GetImgDir(False))
For Each i As String In f
Dim x As New System.IO.FileInfo(i)
i = x.Name
Dim li As New ListItem
li.Text = i
li.Value = i
lb.Items.Add(i)
Next
 

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

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top