Hi (again),
I have the following ListView definition:
<telerik:RadListBox ID="radListBoxGroups" runat="server" |
AllowDelete="false" |
AllowReorder="false" |
AllowTransfer="true" |
AllowTransferDuplicates="false" |
AllowTransferOnDoubleClick="true" |
CheckBoxes="false" |
SelectionMode="Multiple" |
TransferMode="Move" |
Height="300" |
Width="180" |
TransferToID="radListBoxGroupsSelected" |
> |
<ButtonSettings Position="Right" |
RenderButtonText="false" |
ShowDelete="false" |
ShowReorder="false" |
ShowTransfer="true" |
ShowTransferAll="false" |
VerticalAlign="Middle" /> |
</telerik:RadListBox> |
<telerik:RadListBox ID="radListBoxGroupsSelected" runat="server" |
Height="300" Width="170"> |
</telerik:RadListBox> |
And I use the following code to populate it:
var query = from dg in _dataGroups |
join dgi in _originalDataGroupItems on dg.ID equals dgi.ParentDataGroup.ID into sr |
from x in sr.DefaultIfEmpty() |
select new { DataGroupID = dg.ID, IsEnabled = x != null, DataGroupName = dg.Name }; |
foreach (var q in query) |
{ |
RadListBoxItem radListBoxItem=new RadListBoxItem(q.DataGroupName,q.DataGroupID.ToString()); |
radListBoxGroups.Items.Add(radListBoxItem); |
if (q.IsEnabled) |
{ |
radListBoxItem.Selected = true; |
} |
} |
I have traced through and some items are set to Selected==true, yet the ListView does not reflect this. The UI does not move items to the right-hand list and the SelectedItems collection returns Count==0.
What am I doing wrong?