Disable listbox (with transferlist) without hiding transferbuttons?

4 posts, 0 answers
  1. Datamex
    Datamex avatar
    161 posts
    Member since:
    Jun 2012

    Posted 09 Sep 2009 Link to this post

    Would it be possible to disable the listboxes without hiding the buttons that make it possible to swap items between the lists? (in other words, some sort of "ReadOnly"-mode, without changing the look of the controls)

    1 <telerik:RadListBox ID="DualList" runat="server" AllowTransfer="true" AllowTransferOnDoubleClick="false" 
    DataSourceID="EmployeesDataSource" DataTextField="Name" DataValueField="EmployeeID" TransferToID="TransferToList" 
    Width="230px" Height="200px" Culture="Dutch (Netherlands)" EnableDragAndDrop="false" SelectionMode="Multiple" 
    OnDataBound="DualList_DataBound" Enabled="false">  
    2 </telerik:RadListBox> 
    3 <telerik:RadListBox ID="TransferToList" runat="server" DataSourceID="PreferredEngineersDataSource" DataTextField="Name" 
    DataValueField="EmployeeID" Width="230px" Height="200px" AllowTransfer="false" AllowTransferOnDoubleClick="false" 
    Culture="Dutch (Netherlands)" EnableDragAndDrop="false" SelectionMode="Multiple" OnDataBound="TransferToList_DataBound" 
    4 </telerik:RadListBox> 

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

    Posted 09 Sep 2009 Link to this post


    Try the approach by attaching ' OnClientTransferring ' event to RadListBox and prevent the item transferring using set_cancel(true) method in the event handler.

    <telerik:RadListBox ID="DualList" runat="server" AllowTransfer="true" AllowTransferOnDoubleClick="false" 
        DataTextField="Name" DataValueField="EmployeeID" TransferToID="TransferToList" OnClientTransferring="ClientTransferring" 
        Width="230px" Height="200px" Culture="Dutch (Netherlands)" EnableDragAndDrop="false" 
        SelectionMode="Multiple" >      
    <telerik:RadListBox ID="TransferToList" runat="server" Width="230px" Height="200px" 
        AllowTransfer="false" AllowTransferOnDoubleClick="false" Culture="Dutch (Netherlands)" 
        EnableDragAndDrop="false" SelectionMode="Multiple" > 

    <script type="text/javascript"
    function ClientTransferring(sender, args) 
        alert('The item cannot be transfered !');     

  3. Datamex
    Datamex avatar
    161 posts
    Member since:
    Jun 2012

    Posted 09 Sep 2009 Link to this post

    But then the buttons are stil enabled... Can't the buttons just be disabled, without hiding them?
  4. Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 11 Sep 2009 Link to this post

    Hi Datamex,

    You can use the following code to disable the buttons:

     function pageLoad() { 
                var listBox = $find("rlb"); 
                $telerik.$(".rlbItem", listBox.get_element()) 
                    .live("click"function(e) { 
            function disableButtons(listBox) { 
                var $ = $telerik.$; 

    You can call the disableButtons functon whenever you want to have all the buttons disabled.

    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.
Back to Top