Populate DropDownList

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Benedictum

    #1

    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?


  • =?Utf-8?B?UGV0ZQ==?=

    #2
    RE: Populate DropDownList

    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.Fil eSystem.GetFile s function to return a ReadOnlyCollect ion(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?
    >
    >
    >

    Comment

    Working...