We are transferring items between two RadListBox controls but we're finding that SortItems() does a text sort instead of a numeric sort so that all the 900s are listing before the 1000s (Sort="Descending"). I've tried setting the DataSortField, which says it needs to be a numeric field, but that doesn't help.
The markup and codebehind are posted below. Thanks for your help.
Dan Norton
<div style="float: left; width: 350px; vertical-align: middle; margin-left:30px; margin-top: 15px;"> <asp:Label runat="server" id="Label1" AssociatedControlId="radWorkOrderList" Text="Work Orders:" /> <telerik:RadListBox runat="server" ID="radWorkOrderList" Width="350px" Height="200px" SelectionMode="Multiple" AllowTransfer="true" TransferToID="radAssignedWorkOrderList" AutoPostBackOnTransfer="true" AllowReorder="false" OnTransferring="radWorkOrderList_Transferring" EnableDragAndDrop="true" Sort="Descending" DataSortField="Number" DataTextField="Number" DataValueField="Id"> <ItemTemplate> <asp:HyperLink runat="server" Width="50" Text='<%# DataBinder.Eval(Container.DataItem, "Number")%>' ID="lnkWorkOrderEdit" style="vertical-align:text-top;" NavigateUrl='<%# GetWorkOrderNavigationURL(DataBinder.Eval(Container.DataItem, "Id")) %>' ToolTip='<%# DataBinder.Eval(Container.DataItem, "Description") %>' /> <asp:Label ID="lblWorkOrderDescription" Width="225" runat="server" Text='<%# GetShortDescription(DataBinder.Eval(Container.DataItem, "Description")) %>' /> </ItemTemplate> </telerik:RadListBox> </div> <div style="float: left; width: 375px; margin: 0px; margin-top: 15px;"> <asp:Label runat="server" id="Label2" AssociatedControlId="radAssignedWorkOrderList" Text="Work Orders assigned to this Project:" /> <telerik:RadListBox runat="server" ID="radAssignedWorkOrderList" Width="375px" Height="200px" SelectionMode="Multiple" AllowReorder="false" EnableDragAndDrop="true" Sort="Descending" DataSortField="WorkOrderNumber" DataTextField="WorkOrderNumber" DataValueField="WorkOrderId" > <ItemTemplate> <asp:HyperLink runat="server" Width="50" Text='<%# DataBinder.Eval(Container.DataItem, "WorkOrderNumber")%>' ID="lnkAssignedWorkOrderEdit" style="vertical-align:text-top;" NavigateUrl='<%# GetWorkOrderNavigationURL(DataBinder.Eval(Container.DataItem, "WorkOrderId")) %>' ToolTip='<%# DataBinder.Eval(Container.DataItem, "WorkOrderDescription") %>' /> <asp:Label ID="lblAssignedWorkOrderDescription" Width="225" runat="server" Text='<%# GetShortDescription(DataBinder.Eval(Container.DataItem, "WorkOrderDescription")) %>' /> <asp:Label ID="lblAssignedWorkOrderStatus" Width="75" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "WorkOrderStatus") %>' /> </ItemTemplate> </telerik:RadListBox> </div> protected void radWorkOrderList_Transferring(object sender, RadListBoxTransferringEventArgs e) { RadListBoxItem destinationItem = new RadListBoxItem(); foreach (RadListBoxItem sourceItem in e.Items) { destinationItem = new RadListBoxItem(); if (e.SourceListBox == radWorkOrderList) { radAssignedWorkOrderList.Items.Add(destinationItem); destinationItem.Value = sourceItem.Value; destinationItem.Text = sourceItem.Text; HyperLink lnkSourceWorkOrderNumber = sourceItem.FindControl("lnkWorkOrderEdit") as HyperLink; HyperLink lnkDestinationWorkOrderNumber = radAssignedWorkOrderList.Items.Last().FindControl("lnkAssignedWorkOrderEdit") as HyperLink; lnkDestinationWorkOrderNumber.NavigateUrl = lnkSourceWorkOrderNumber.NavigateUrl; lnkDestinationWorkOrderNumber.Text = lnkSourceWorkOrderNumber.Text; lnkDestinationWorkOrderNumber.ToolTip = lnkSourceWorkOrderNumber.ToolTip; Label lblSourceWorkOrderDescription = sourceItem.FindControl("lblWorkOrderDescription") as Label; Label lblDestinationWorkOrderDescription = radAssignedWorkOrderList.Items.Last().FindControl("lblAssignedWorkOrderDescription") as Label; lblDestinationWorkOrderDescription.Text = lblSourceWorkOrderDescription.Text; WorkOrder destinationWorkOrder = new WorkOrder(AppSession, int.Parse(destinationItem.Value)); Status destinationWorkOrderStatus = new Status(AppSession, destinationWorkOrder.StatusId); Label lblDestinationWorkOrderStatus = radAssignedWorkOrderList.Items.Last().FindControl("lblAssignedWorkOrderStatus") as Label; lblDestinationWorkOrderStatus.ID = "lblAssignedWorkOrderStatus"; lblDestinationWorkOrderStatus.Text = destinationWorkOrderStatus.Name; radWorkOrderList.Items.Remove(sourceItem); } else { radWorkOrderList.Items.Add(destinationItem); radWorkOrderList.Items.Last().Value = sourceItem.Value; radWorkOrderList.Items.Last().Text = sourceItem.Text; HyperLink lnkSourceWorkOrderNumber = sourceItem.FindControl("lnkAssignedWorkOrderEdit") as HyperLink; HyperLink lnkDestinationWorkOrderNumber = radWorkOrderList.Items.Last().FindControl("lnkWorkOrderEdit") as HyperLink; lnkDestinationWorkOrderNumber.NavigateUrl = lnkSourceWorkOrderNumber.NavigateUrl; lnkDestinationWorkOrderNumber.Text = lnkSourceWorkOrderNumber.Text; lnkDestinationWorkOrderNumber.ToolTip = lnkSourceWorkOrderNumber.ToolTip; Label lblSourceWorkOrderDescription = sourceItem.FindControl("lblAssignedWorkOrderDescription") as Label; Label lblDestinationWorkOrderDescription = radWorkOrderList.Items.Last().FindControl("lblWorkOrderDescription") as Label; lblDestinationWorkOrderDescription.Text = lblSourceWorkOrderDescription.Text; radAssignedWorkOrderList.Items.Remove(sourceItem); } } if (e.DestinationListBox == radWorkOrderList) { radWorkOrderList.SortItems(); } else { radAssignedWorkOrderList.SortItems(); } e.Cancel = true; }