RadListBox - SortItems issue

6 posts, 1 answers
  1. Mathew
    Mathew avatar
    20 posts
    Member since:
    Nov 2010

    Posted 12 Apr 2011 Link to this post

    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

  2. Dean
    Dean avatar
    43 posts
    Member since:
    Jun 2009

    Posted 12 Apr 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mathew
    Mathew avatar
    20 posts
    Member since:
    Nov 2010

    Posted 12 Apr 2011 Link to this post

    Version 2010.3.1317.35
  5. Dean
    Dean avatar
    43 posts
    Member since:
    Jun 2009

    Posted 13 Apr 2011 Link to this post

    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.
  6. Answer
    Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 15 Apr 2011 Link to this post

    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.

  7. Mathew
    Mathew avatar
    20 posts
    Member since:
    Nov 2010

    Posted 15 Apr 2011 Link to this post

    That works!  Thanks Peter!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017