473,508 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview - how get files in a dir for a ddl

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
Feb 7 '06 #1
2 1480
lb.Items.Add(li) ?? and not i
"VB Programmer" <do**@emailme.com> wrote in message
news:OI**************@TK2MSFTNGP11.phx.gbl...
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

Feb 7 '06 #2
Thanks. But I still haven't figured it out. Any ideas?

"MSDN" <sq**********@hotmail.com> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
lb.Items.Add(li) ?? and not i
"VB Programmer" <do**@emailme.com> wrote in message
news:OI**************@TK2MSFTNGP11.phx.gbl...
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


Feb 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5658
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
18
6487
by: Auto | last post by:
Hello, I would like to know how do display an image into a Gridview (ASP.NET 2.0) taken directly from a DataBase, NOT using an URL, like described in this article: ...
0
8048
by: ssims | last post by:
I've got a GridView that's sorted by a stored procedure with ROW_NUMBER: PROCEDURE dbo.GetCalendarsByStatusIDPaged ( @startRowIndex int, @maximumRows int, @statusID int ) AS
0
3546
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
2367
by: den 2005 | last post by:
Hi everybody, I created a Gridview with a TemplateField and there is Label control in ItemTemplate and a DropdownList control in EditItemTemplate, I was to displayed them ok when I click the...
8
9645
by: =?Utf-8?B?TWlrZSBSYW5k?= | last post by:
I am trying to get a list of files from a specified directory using the System.IO namespace classes, and then use that list as the datasource for a GridView. I have been able to do this...
10
5724
by: gnewsgroup | last post by:
I've googled and tried various approaches, but could not resolve this problem. The article at MSDN: Displaying Images in a GridView Column only presents a simple case where all data (including the...
2
2801
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files...
0
2467
by: arun | last post by:
Hi I have a GridView which I will bind to different DataTables in a DataSet. There is a UserControl which will have as many number of buttons as the number of DataTables in the DataSet. When I...
2
5975
by: =?Utf-8?B?UGF1bA==?= | last post by:
I have a gridview with 2 columns. One column is a BoundColumn to a part number (string). One column is an ItemTemplate with a FileUpload control. There can be multiple rows (i.e. part numbers)...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7115
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.