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

Disable or remove listbox button

7 Answers 446 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Mohan
Top achievements
Rank 1
Mohan asked on 10 Jul 2009, 06:26 PM
I have 2 listboxes and would like allow only one way transfers. By default both right and left button show up. Is it possible to disable/remove one of them .

Thanks

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jul 2009, 12:59 PM
Hi mohan,

One suggestion would be cancel transferring item using args.set_cancel(true) in OnClientTransferring event. See the example.

aspx:
 
<telerik:RadListBox runat="server" ID="RadListBoxSource" Height="200px" Width="230px" 
    OnClientTransferring="OnClientTransferring" AllowTransfer="True" TransferToID="RadListBoxDestination"
    <Items> 
        <telerik:RadListBoxItem Text="Argentina" runat="server" /> 
        <telerik:RadListBoxItem Text="Australia" runat="server" /> 
        <telerik:RadListBoxItem Text="Brazil" runat="server" /> 
    </Items> 
</telerik:RadListBox> 
<telerik:RadListBox runat="server" ID="RadListBoxDestination" Height="200px" Width="200px"
</telerik:RadListBox> 

javascript:
 
<script type="text/javascript"
function OnClientTransferring(sender, args) 
    if(args.get_sourceListBox() != sender) 
    { 
        args.set_cancel(true); 
        alert('Cannot transfer the item.'); 
    } 
</script> 

-Shinu.
0
Accepted
Genady Sergeev
Telerik team
answered on 13 Jul 2009, 03:03 PM
Hi Mohan,

As Shinu properly mentioned, one of the possible solutions is to use the client side API. The other option is to hide one of the transfer buttons. Example code:

 
        function pageLoad() { 
            var $ = $telerik.$; 
            var listBox = $find("RadListBox1"); 
 
            $(".rlbTransferToDisabled", listBox.get_element()).css("display""none"); 
        } 


Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Wendy Hunt
Top achievements
Rank 2
answered on 15 Jan 2010, 10:50 PM
Hi Genady -

Is there a way to do this without using javascript?  Instead write code on the .cs page?

wen
0
Genady Sergeev
Telerik team
answered on 19 Jan 2010, 10:16 AM
Hello Wendy Hunt,

Unfortunately there is no way to this on the server. Currently RadListBox does not support API that allows you to configure which transfer buttons should appear. However, such API exists for the Reorder buttons. I will add this feature request to our PITS system and if you feel that such API will be helpfull, please vote for this feature. If there are more customers that demand it, we will implement it. The PITS work item is going to be visible forth from tomorrow

Sincerely yours,
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
Wendy Hunt
Top achievements
Rank 2
answered on 19 Jan 2010, 03:56 PM
My goal would be to have the ability to enable and disable the listbox buttons through my .cs code.

Thanks for the information Genady!

wen
0
Genady Sergeev
Telerik team
answered on 22 Jan 2010, 09:48 AM
Hello Wendy Hunt,

The feature request is now available in our PITS system and you can vote for it here.

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
Bradley Fitzpatrick
Top achievements
Rank 1
answered on 09 Jul 2010, 03:33 PM
I don't see this feature in PITS when searching for radlistbox. Has it been implemented?

Edit: Disregard, I just saw the "Hide the transfer to left button" section for RadListBox.
Tags
ListBox
Asked by
Mohan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Genady Sergeev
Telerik team
Wendy Hunt
Top achievements
Rank 2
Bradley Fitzpatrick
Top achievements
Rank 1
Share this question
or