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

RadListBox

4 Answers 11 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
sandeep
Top achievements
Rank 1
sandeep asked on 22 Sep 2014, 10:32 AM
How  to prevent  a particular item from left to right using code on server side or by using javascript on client side.

Eg: If user want to move 'Argentina' from left to right,i want to prevent  and show an alert message saying  "It is not possible"  


           RoleSelectedListBox = new RadListBox();
            RoleSelectedListBox.ID = "RoleSelectedListBox";
            RoleSelectedListBox.TabIndex = 1;
            //RoleSelectedListBox.CssClass = "RoleSelectedListBoxStyle";
            RoleSelectedListBox.SelectionMode = ListBoxSelectionMode.Multiple;
            RoleSelectedListBox.AllowTransfer = true;
            RoleSelectedListBox.TransferToID = "RoleAvailableListBox";
            RoleSelectedListBox.Skin = "FuzeCustom";
            RoleSelectedListBox.EnableEmbeddedSkins = false;
            RoleSelectedListBox.EnableDragAndDrop = true;
            RoleSelectedListBox.EnableMarkMatches = true;
            RoleSelectedListBox.Sort = RadListBoxSort.Ascending;
            RoleSelectedListBox.SortItems(); 

4 Answers, 1 is accepted

Sort by
0
sandeep
Top achievements
Rank 1
answered on 22 Sep 2014, 02:12 PM
Can any one help me to find the solution for this....please..
0
Nencho
Telerik team
answered on 25 Sep 2014, 08:54 AM
Hello,

In order to achieve the desired functionality, you could use the OnClientTransferring client-side event. In the handler, you could verify the Source ListBox  (using get_sourceListBox().get_id() ) and the item, which is currently about to be transfer. If the item's text is Argentina, you could use the args.set_cancel(true) function to cancel the transfer.
I have prepared as sample example for you, demonstrating the implementation of the above suggestion.


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.

 
0
sandeep
Top achievements
Rank 1
answered on 25 Sep 2014, 09:11 AM
It is working fine when i am transferring single item from left to right,but when i am trying to transfer all items from left to right, except "Agentina",this is raising an alert even i specify the condition as like you mentioned in the attachment...
0
Nencho
Telerik team
answered on 29 Sep 2014, 12:46 PM
Hello,

In case of a multiple transfer, I would suggest you to implement the approach, demonstrated in the following documentation article :

http://www.telerik.com/help/aspnet-ajax/listbox-how-to-transfer-specific-items-with-transferall-button.html

Basically, you would need to cancel the entire Transferring event and manually transfer the items, that meet the needed requirements for transfer.

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
sandeep
Top achievements
Rank 1
Answers by
sandeep
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or