Can I populate a combobox with filenames from a network share?

3 posts, 1 answers
  1. fred williams
    fred williams avatar
    55 posts
    Member since:
    Feb 2010

    Posted 09 Nov 2010 Link to this post

    So they'd like me to create an application where the files from a particular network folder populate into some kind of box with checkboxes, so they can select as many as they'd like and upload them to our sql database (I know).

    The only thing I coudl think of from your suite of products was a combobox, since the fileexplorer doesn't have checkboxes or the ability to select files from within the explorer window and upload them all at once.

    Is there anyway I can populate th ecombobox with files from a folder? This way they'd be able to select them with the checkboxes and I could handle the sql upload in codebehind. If this isn't possible or more work than it's worth (which i think it is) please let me know.
  2. Answer
    Simon
    Admin
    Simon avatar
    2281 posts

    Posted 11 Nov 2010 Link to this post

    Hello fred williams,

    Your assumption is correct - there is no straightforward way to bind a RadComboBox to a list of files on a shared folder.

    In case you are interested in just seeing how a possible 'implementation-plan' would look here are the basic steps you need to do to achieve the goal:
    1. Create a list (most conveniently an array) of all files that you need to display (here is a short sample of how to do that).
    2. Visualize the data in a suitable manner. You have two options:
      •  Define a RadComboBox ItemTemplate that will consist of a CheckBox and a Label in its simplest form. Here is an example of such a Template in action.
      • (Alternative) You can use another control, which supports CheckBox internally so you will not need to define anything additional, as RadListBox. Here is a demo showing CheckBoxes in action.
    3. Iterate through the checked Items and store their text/values in the data base.

    So, you can use RadComboBox with a bit of additional code and markup or directly bind a RadListBox with CheckBoxes enabled to the underlying array.

    I hope this info help you make the decision.

    Kind regards,
    Simon
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. fred williams
    fred williams avatar
    55 posts
    Member since:
    Feb 2010

    Posted 12 Nov 2010 Link to this post

    Thanks, I ended up using the directory info class to populate the combobox. worked perfectly!
Back to Top