This is a migrated thread and some comments may be shown as answers.

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

2 Answers 65 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
fred williams
Top achievements
Rank 1
fred williams asked on 09 Nov 2010, 03:58 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 11 Nov 2010, 09:46 PM
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
0
fred williams
Top achievements
Rank 1
answered on 12 Nov 2010, 05:22 PM
Thanks, I ended up using the directory info class to populate the combobox. worked perfectly!
Tags
ComboBox
Asked by
fred williams
Top achievements
Rank 1
Answers by
Simon
Telerik team
fred williams
Top achievements
Rank 1
Share this question
or