473,396 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Populate DropDownList

In a web site, I have a folder that contains text files (*.txt). I need to
get the server path and all files (txt type) and add it to a dropdown list
control. How do I do this?
Nov 6 '07 #1
1 1178
In VB.Net 2005, it's very simple - you could do it like this: Get the name of
the physical folder - use Server.MapPath if you don't know. Use the
My.Computer.FileSystem.GetFiles function to return a ReadOnlyCollection(of
String) containing the filenames of files in that folder. Loop thru
collection (For Each..). Check if the filename ends with .txt. If so add the
string to the combo.items collection using the add method.

Hope that makes sense.

Pete

"Benedictum" wrote:
In a web site, I have a folder that contains text files (*.txt). I need to
get the server path and all files (txt type) and add it to a dropdown list
control. How do I do this?
Nov 8 '07 #2

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

Similar topics

0
by: Jeff Johnson | last post by:
I'm trying to populate a DropDownList with two columns of data I'm receiving from a stored procedure. All the examples I've found so far have mentioned modifying the SQL and are written in VB. ...
2
by: Rui Macdonald | last post by:
What is wrong with this code to populate a DropDownList? Can somebody Help me? Tnx RMac ===================================================================================== WebForm.aspx.vb
1
by: mr2_93 | last post by:
Hi All, I am new to ASP.NET and I am looking for help with the dropdownlist data control. I wonder if someone could show me how to past the SelectedValue of a data-bind dropdownlist to...
2
by: bobbyc13 | last post by:
I am new to vb.net and am getting frustrated and cannot find a post on the subject. I have a usercontrol (.ascx) with a dropdownlist. on the selectedindexchanged event of the codebeside of the...
3
by: sweetpotatop | last post by:
Hi, I am try to populate a number of dropdownlist with the same item, for i = 1 to 5 dd = me.controls("dd" + Cstr(i)) itm = new listiem itm.text ="abc" itm.value ="aaa"
6
by: peerraghu | last post by:
hi i am developing website which is a online shoping i want to populate two dropdownlist, in which the first dropdownlist should place the list of a paticular product and the next dropdownlist...
1
by: sudip2008 | last post by:
When using the Calendar Popup in a content page of a masterpage the strForName is always set to aspnetForm This breaks this line from working properly window.opener.document.forms...... How can...
0
by: mkidd | last post by:
Hi, I'm trying to build an online form using asp.net and vb.net for the code behind in Visual Studio 2005. I want to fill 3 fields in a FormView that's connected to one table (table1) with...
2
by: Aswanth | last post by:
Hi.. I'm using Asp.Net with C#.... I'm having One Dropdownlist control(Users_Details_DDL) in Default.aspx Page... i'm having one Stored Procedure (Get_User_Email) which will display the Data...
5
by: =?Utf-8?B?U2F0aXNo?= | last post by:
C#, ASP.NET Q: Have a formview, with a dropdownlist which is bound to a column. This dropdownlist has a datasource of DataSet type. Now my objective is, on Selection Changed of this DropdownList,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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
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...

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.