Disable or remove listbox button

8 posts, 1 answers
  1. Mohan
    Mohan avatar
    22 posts
    Member since:
    Apr 2009

    Posted 10 Jul 2009 Link to this post

    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

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jul 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 13 Jul 2009 Link to this post

    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.
  5. Wendy Hunt
    Wendy Hunt avatar
    50 posts
    Member since:
    Nov 2009

    Posted 15 Jan 2010 Link to this post

    Hi Genady -

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

    wen
  6. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 19 Jan 2010 Link to this post

    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.
  7. Wendy Hunt
    Wendy Hunt avatar
    50 posts
    Member since:
    Nov 2009

    Posted 19 Jan 2010 Link to this post

    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
  8. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 22 Jan 2010 Link to this post

    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.
  9. Bradley Fitzpatrick
    Bradley Fitzpatrick avatar
    3 posts
    Member since:
    Apr 2010

    Posted 09 Jul 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017