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

RadListBox - TransferAll

4 Answers 81 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Konstantin Vyaznikov
Top achievements
Rank 1
Konstantin Vyaznikov asked on 29 Oct 2009, 06:41 PM
Is there a way to transfer all items from source listbox to destination listbox on a client side using javascript?

Thanks!

4 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 29 Oct 2009, 09:46 PM
I believe this documentation article, with some modification, should allow you to transfer all of the items in your RadListBox through client-side.
0
Genady Sergeev
Telerik team
answered on 02 Nov 2009, 09:06 AM
Hello Konstantin Vyaznikov,

Transferring items on the client using JavaScript is supported by default. The only thing you need to do is to set the TransferTo property of the source and make sure that the AllowTransfer property is set to true. You can find example demonstrating the approach here.


Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Warren
Top achievements
Rank 2
answered on 28 Jun 2014, 11:06 PM
I know this forum question is quite old but I wanted to share this javascript function I created to transfer all items from the source listbox to the destination listbox or all items from the destination listbox to the source listbox.  I wrote this to handle the user checking a checkbox to indicate an "All" items.  I then added a client onclick to the ASP.NET checkbox to call this function.  Make sure the source list box has these set AllowTransfer="true" and the TransferToID="destinationListBox".

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function TransferAllListBoxItems(sourceListBoxName,destListBoxName,checked)
        {
            var listSrc = $find(sourceListBoxName);
            var listDst = $find(destListBoxName);
            if(checked)
            {
                while (listSrc.get_items().get_count() > 0) {
                    listSrc.transferToDestination(listSrc.getItem(0));
                }
            }
            else
            {
                while (listDst.get_items().get_count() > 0) {
                    listSrc.transferFromDestination(listDst.getItem(0));
                }
            }
        }
    </script>
</telerik:RadCodeBlock>
0
Nencho
Telerik team
answered on 02 Jul 2014, 07:27 AM
Hello Warren,

Thank you for sharing your solution with the community.

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ListBox
Asked by
Konstantin Vyaznikov
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Genady Sergeev
Telerik team
Warren
Top achievements
Rank 2
Nencho
Telerik team
Share this question
or