So I’m using the directoryinfo class to obtain the filenames from a network share, and then display them into my radcombobox. Everything works fine, but what I’d like to do is create a checkbox next to all of the values in the combobox so the user can select multiple files.
When I do it without the itemtemplate, all the filenames display fine, but when I try to use them to add the checkbox, the checkboxes show up but the filenames don’t. Here’s what I have:
<
telerik:RadComboBox
ID
=
"cboFiles"
runat
=
"server"
AutoPostBack
=
"true"
Width
=
"350px"
OnItemDataBound
=
"cboFilesDBound"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"chkFile"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:RadComboBox
>
Here's the codebehind:
protected
void
setDirectory(String path)
{
RadComboBox cb = (RadComboBox)FindControl(
"cboFiles"
);
DirectoryInfo di =
new
DirectoryInfo(path);
FileInfo[] files = di.GetFiles();
foreach
(FileInfo f
in
files)
{
RadComboBoxItem item =
new
RadComboBoxItem(f.Name, f.Name);
item.Attributes[
"displayName"
] = f.Name;
cboFiles.Items.Add(item);
}
}