Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

asp.net problem

  • 30-05-2006 1:01pm
    #1
    Registered Users, Registered Users 2 Posts: 77 ✭✭


    Hi folks, I'm using web matrix at the moment and I would like to display the files from a particular folder in a listbox, would anyone be able to help me???


Comments

  • Registered Users, Registered Users 2 Posts: 872 ✭✭✭grahamor


    what do you mean, a particular folder in the website or on your desktop ?

    You should probably write an xml page that has the name of the file and the reference to where it is and then bind the xml file to the listbox control.

    I am familiar doing this with databases but not any other way

    edit: you should download visual web developer 2005 aswell (it's free), web matrix is discontinued and shi*te because there is no predicitive code writing (intellisense) which will save you so much time


  • Registered Users, Registered Users 2 Posts: 683 ✭✭✭Gosh


    This should do .. just call it for each folder (with the full path name)
    Sub BuildFileList(strFolder)
       Set oFolder = oFS.getFolder(strFolder)
       Echo("<SELECT NAME=filelist>")
       For Each FileName in oFolder.Files
          Echo("<OPTION VALUE=" & Chr(34) & FileName.Name _
          & Chr(34) & ">" & FileName.Name & "</OPTION>")
       Next
       Echo ("</SELECT>")
       Set oFolder = Nothing
    End Sub
    


  • Registered Users, Registered Users 2 Posts: 77 ✭✭peteym


    The folder is located on a shared drive - trying to download microsoft web developer thingy but for some reason won't install for me.

    Thanks for your help guys


  • Closed Accounts Posts: 140 ✭✭Sneaky_Russian


    in the page load, you could do something like so to list the files in the current directory
    if(!IsPostBack)
        foreach(string filename in System.IO.Directory.GetFiles(Server.MapPath("~/")))
            ListBox1.Items.Add(new ListItem(filename));
    
    


Advertisement