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

drag and drop for RadListBox

1 Answer 99 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Baris
Top achievements
Rank 1
Baris asked on 05 Mar 2014, 04:10 PM
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>

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 07 Mar 2014, 06:54 AM
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!

Tags
ListBox
Asked by
Baris
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or