drag and drop for RadListBox

2 posts, 0 answers
  1. Baris
    Baris avatar
    34 posts
    Member since:
    Jul 2013

    Posted 05 Mar 2014 Link to this post

    Hi,

    I want to use drag and drop feature between 2 Listbox. I am loading the data from server for 1st listbox. I can succesfully load the data and can see it in 1st listbox however i cant drag and drop to the second listbox the selected items. Thank you in advance for ur help.

    this is how i load the data in code behind:
    ​ public void Populate()
    {


    var client = new Organon.IM.Presentation.IMPresentationService.PresentationServiceClient();
    OperationResultDto<UserDto[]> Users = client.GetAllUsers();

    var source = new BindingSource();
    source.DataSource = Users.Data;
    rlAssignments.DataSource = source;
    rlAssignments.DataBind();

    }


    this is the code i am using the listboxes:

           <telerik:RadListBox ID="rlAssignments" runat="server" TransferMode="Copy" Width="250px" BackColor="#2D1A44" SelectionMode="Multiple" AllowTransfer="True" TransferToID="rlModellers" AutoPostBackOnTransfer="true"
    AllowReorder="True" AutoPostBackOnReorder="true" EnableDragAndDrop="true" Skin="" CssClass="app-check">
    <ItemTemplate>
    <p><%# Eval("Username") %></p>
    </ItemTemplate>

    </telerik:RadListBox>


    <telerik:RadListBox ID="rlModellers" runat="server" AllowTransfer="true" AutoPostBackOnTransfer="true"
    SelectionMode="Multiple" AllowReorder="true" AutoPostBackOnReorder="true" EnableDragAndDrop="true"
    Skin="" Width="510px">
    <ItemTemplate>
    <table style="width: 250px">
    <tr style="width: 250px">
    <td style="width: 470px"><span class="name fl"></span>
    <span class="buttons fr">
    <a href="" class="mini-action icon-delete-mini"></a>
    </span>
    </td>

    </tr>
    </table>
    </ItemTemplate>

    </telerik:RadListBox>
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 07 Mar 2014 Link to this post

    Hello,

    When transferring templated items between two ListBoxes you have to call DataBind() once each item is transferred, using the OnTransferred event, as demonstrated in the following demo:
    http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/templates/defaultcs.aspx

    Regards,
    Bozhidar
    Telerik

    DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top