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

Reorder post back seems to pass different data for drag and drop vs buttons

4 Answers 49 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Patrick Patterson
Top achievements
Rank 2
Patrick Patterson asked on 02 Apr 2010, 11:39 PM
Hello -

I have an issue where I have a ListBox with 4 items in it, ordered Item 1, Item 2, Item 3, Item 4.  When I select Item 2 and drag to infront of Item 1, my code on the postback doesn't seem to register the reorder. Although the event is firing, the code is getting data that in the ItemCollection that resembles the original list.

So just for fun, I turned on the button and tried it.  In this case, everything works. 

So I trace through both approaches, and the Sender object I pass in is different in both cases.  The Selected item is Item 2 in both cases, but the Item collection from drag and drop is (1, 2, 3, 4) and the item collection from button up is (2, 1, 3, 4).  I have tried a variety of combinations and it always seems to follow the same way.

Even stranger, I do the same thing elsewhere on a different page, and it doesn't have this problem at all. 

As far as I can tell, all the setting on the two controls are the same.

Is there any known issue that might be causing this?  Is there anything you suggest we can try to do differently to sort it out?

Thanks-
P.J.

4 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 05 Apr 2010, 03:53 PM
Hi Patrick Patterson,

Which version of the controls do you use? I have tried with the latest version and the order seems to be correctly preserved as the page is postedback. I am attaching my sample project to this replay, can you reproduce the problem on it?

Best wishes,
Genady Sergeev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Patrick Patterson
Top achievements
Rank 2
answered on 05 Apr 2010, 04:46 PM

I am using 2010.1.216.35.

The strange thing is, we have two pages that appear to be basically identical, one passes the after-drop collection and one passes the before-drop collection.  Shouldn't it consistantly pass the after drop? 

Here is the one that works:
    <telerik:RadListBox ID="lstSortedFields" runat="server" SelectionMode="Multiple"

 

 

 

 

        AllowTransfer="True" AutoPostBackOnTransfer="True" AllowReorder="True" AutoPostBackOnReorder="True"

 

 

 

 

        EnableDragAndDrop="True" TransferToID="lstAvailableFields" Height="300px" Width="250px"

 

 

 

        OnTransferred="OnSortedListTransferred" OnUpdated="OnSortedListUpdated"
    
>

 

 

 

 

        <ButtonSettings ShowReorder="false" ShowTransfer="false" ShowTransferAll="false" />

 

 

 

 

        <ItemTemplate>

 

 

 

 

            <asp:Image ID="imgIcon" runat="server" ImageUrl='<%# Eval("Icon") %>' />

 

 

 

 

            <asp:Literal ID="ltrText" runat='server' Text='<%# Eval("DisplayName") %>'></asp:Literal>

 

 

 

 

        </ItemTemplate>

 

 

 

 

    </telerik:RadListBox>

 

 

 

 

 
--
protected void OnSortedListUpdated(object sender, RadListBoxEventArgs e)

 

{

 

 

    if (SortedListUpdatedEvent != null)

 

        SortedListUpdatedEvent(sender, e);

}

 

 


And here is the one that doesn't:
    <telerik:RadListBox ID="lstSelectedFields" runat="server" SelectionMode="Multiple" AutoPostBack="true"

 

 

 

 

        AllowTransfer="True" AutoPostBackOnTransfer="True" AllowReorder="true" AutoPostBackOnReorder="true"

 

 

 

 

        EnableDragAndDrop="True" TransferToID="lstAvailableFields" Height="300px" Width="250px"

 

 

 

        OnInserted = "OnSelectedListInserted"

 

 

 

        OnReordered="OnSelectedListReorderedEvent" OnTransferred="OnSelectedListTransferred">

 

 

 

 

        <ButtonSettings ShowReorder="true" ShowTransfer="false" ShowTransferAll="false" />

 

 

 

 

    </telerik:RadListBox>

 

 

 

 

-----

 

 

 

    protected void OnSelectedListReorderedEvent(object sender, RadListBoxEventArgs e)

 

    {

 

 

        if (SelectedListReorderedEvent != null)

 

        {    

            SelectedListReorderedEvent(sender, e);

        }

    }

 

 

On the first, I trace the program to OnSortedListUpdated and sender.Items.base.base.NonPublic._collectionItems shows the list of items in the box in the order they should be AFTER the drop is complete (even though the UI doesn't actually reflect the new order until later).

On the second page, I trace the program ro OnSelectedListReorderedEvent and sender.Items.base.base.NonPublic._collectionItems shows the list of items in the box in the order they should be BEFORE the drop is complete.  However, as you can see I also turned on the buttons, and if I use the up button rather than drag/drop, then it is like the first page  (sender.Items.base.base.NonPublic._collectionItems shows the list of items in the box in the order they should be AFTER the drop is complete).

Now I do see that for one box I am using OnUpdated and the second is OnReordered, but that doesn't really explain why the second page is sending two different Item collections depending on using button vs drag-and-drop.

Could some setting in here be altering how it works?
 

0
Patrick Patterson
Top achievements
Rank 2
answered on 05 Apr 2010, 05:07 PM
After I posted the last message, I decided to try changing the trigger even in the second page from OnReordered to OnUpdated, and that seems to have worked for me.

Is OnReordered supposed to send different data as I described (and I was using it wrong)?  Or could there be something wrong here?

At least I am able to move forward, but I will try some tests later today on the simplier sample you sent me to see if I can diagnose it further.

Thanks!
0
Simon
Telerik team
answered on 06 Apr 2010, 04:35 PM
Hello Patrick Patterson,

Your observations are correct - Items are not yet reordered in the Reordered event when using drag-and-drop. This is a bug which we will fix immediately.

You can download the next Internal Build from your account to obtain the fixed version.

I updated your Telerik points for the report.

Greetings,
Simon
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ListBox
Asked by
Patrick Patterson
Top achievements
Rank 2
Answers by
Genady Sergeev
Telerik team
Patrick Patterson
Top achievements
Rank 2
Simon
Telerik team
Share this question
or