I have two Telerik radListBoxes (source and destination). Both are databound with their DataKeyField and DataTextField values set. The destination listbox may have some values in it from a prior session.
When I transfer an item from the source listbox to the destination listbox using the built in buttons, I can see the value (text) is transferred over, but the datakey for that item is null.
I'm new to these controls, and everything is working well, except for this.
<telerik:RadListBox runat="server" ID="rlAvailableTitles" Height="200px" Width="300px" ButtonSettings-AreaWidth="35px"
AllowTransfer="true" TransferToID="rlTitles" SelectionMode="Multiple" AppendDataBoundItems="true"
AllowTransferOnDoubleClick="true" DataKeyField="TitleID" DataTextField="TitleName" CssClass="text-align: left;" AutoPostBackOnTransfer="true">
</telerik:RadListBox>
<telerik:RadListBox runat="server" ID="rlTitles" Height="200px" Width="300px" ButtonSettings-AreaWidth="35px"
AllowTransfer="true" TransferToID="rlAvailableTitles" SelectionMode="Multiple" AppendDataBoundItems="true"
AllowTransferOnDoubleClick="true" DataKeyField="TitleID" DataTextField="TitleName">
</telerik:RadListBox>
And after they click on 'save':
foreach (RadListBoxItem item in rlTitles.Items)
{
string myTitleID = item.DataKey;
// etc...
}
What am I missing to get the datakey that is stored with the item in the source listbox?
DataKey has no setter.
Use DataValueField instead.