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

RadListBox - SortItems issue

5 Answers 221 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Mathew
Top achievements
Rank 1
Mathew asked on 12 Apr 2011, 04:33 PM
Hello,
I have 2 list boxes and I have this below code that runs when an item from "RadListBox2" is moved to "RadListBox1". 

It executes and sorts fine after using the buttons to transfer items, however, if I drag/drop then there is an issue.  After dropping on "RadListBox1", it takes the item from "RadListBox2" and puts it in its proper place (meaning alphabetically sorted).  However, it also takes the very last item in "RadListBox1" and moves it up to the location where the item was dropped. 

 

public void RadListBox1_Transferred(object sender, RadListBoxTransferredEventArgs e)

 

 

{

 

RadListBox1.Sort =

RadListBoxSort.Ascending;

 

 

RadListBox1.SortItems();

 

}

So, just an example...
I start with ListBox #1 having values:  a, b, c, x, y, z
Then I drop value "m" from ListBox#2 onto ListBox #1 (location between "a" and "b")and I end up with this list: a, z, b, c, m, x, y  
The location of "m" is fine (it got sorted).  The new location of "z" is the problem.

Has anyone seen this behavior before?

Thanks,
Matt

5 Answers, 1 is accepted

Sort by
0
Dean
Top achievements
Rank 2
answered on 12 Apr 2011, 08:07 PM
Hi Mathew,

I've just tested your problem with version 2011.1.315.35 of the Telerik ASP.NET AJAX Control and found no problems at all, this is the code below that I'm using for my test. What version of the controls are you using?

ASP Markup:

<table>
        <tr>
            <td>
                <telerik:RadListBox ID="RadListBox1" runat="server" AllowTransfer="True"
                    TransferToID="RadListBox2" Sort="Ascending" Height="200px" AutoPostBackOnTransfer="true">
                    <ButtonSettings TransferButtons="All" />
                    <Items>
                        <telerik:RadListBoxItem runat="server" Text="b" Value="b" />
                        <telerik:RadListBoxItem runat="server" Text="a" Value="a" />
                        <telerik:RadListBoxItem runat="server" Text="d" Value="d" />
                        <telerik:RadListBoxItem runat="server" Text="c" Value="c" />
                        <telerik:RadListBoxItem runat="server" Text="z" Value="z" />
                    </Items>
                </telerik:RadListBox>
            </td>
            <td>
                <telerik:RadListBox ID="RadListBox2" runat="server" Sort="Ascending"
                    AllowDelete="True" AllowReorder="True" Height="200px" AutoPostBackOnTransfer="true">
                    <ButtonSettings TransferButtons="All" />
                    <Items>
                        <telerik:RadListBoxItem runat="server" Text="m" Value="m" />
                    </Items>
                </telerik:RadListBox>
            </td>
        </tr>
    </table>

Code Behind:

Private Sub RadListBox1_Transferred(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListBoxTransferredEventArgs) Handles RadListBox1.Transferred
    RadListBox1.Sort = Telerik.Web.UI.RadListBoxSort.Ascending
    RadListBox1.SortItems()
End Sub
 
Private Sub RadListBox2_Transferred(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListBoxTransferredEventArgs) Handles RadListBox2.Transferred
    RadListBox2.Sort = Telerik.Web.UI.RadListBoxSort.Ascending
    RadListBox2.SortItems()
End Sub
0
Mathew
Top achievements
Rank 1
answered on 12 Apr 2011, 09:05 PM
Version 2010.3.1317.35
0
Dean
Top achievements
Rank 2
answered on 13 Apr 2011, 05:58 AM
Hi Mathew,

I see nothing in the release history thats states there was a problem with this and only see new features being added to the RadListBox Control, maybe submit a support ticket and see if the telerik staff can take a look at it.
0
Accepted
Peter Filipov
Telerik team
answered on 15 Apr 2011, 01:48 PM
Hi Mathew,

I was able to reproduce the issue with both versions - 2010.3.1317 and 2011.1.315.
To resolve it please sort items in the Page_PreRender event:

protected void Page_PreRender(object sender, EventArgs e)
{
RadListBox1.Sort = RadListBoxSort.Ascending;
RadListBox1.SortItems();
RadListBox2.Sort = RadListBoxSort.Ascending;
RadListBox2.SortItems();
}

The issue has been forwarded to our development team for further investigation.

Regards,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Mathew
Top achievements
Rank 1
answered on 15 Apr 2011, 07:17 PM
That works!  Thanks Peter!
Tags
ListBox
Asked by
Mathew
Top achievements
Rank 1
Answers by
Dean
Top achievements
Rank 2
Mathew
Top achievements
Rank 1
Peter Filipov
Telerik team
Share this question
or