Multiselect treeview inside DropDown

2 posts, 0 answers
  1. Sreedath Kuttan
    Sreedath Kuttan avatar
    11 posts
    Member since:
    Jun 2008

    Posted 07 Jul 2009 Link to this post

    Hi,
    Is there a way to place a multiselect treeview inside the Dropdown.

    I want the dropdown to shrink to original size once the selections is done(not the expanded view)
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Jul 2009 Link to this post

    Hello Sreenath,

    You can try the following approach to use multi-select treeview in dropdown (RadComboBox).

    ASPX:
     
    <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientDropDownClosing="OnClientDropDownClosing"
        <ItemTemplate> 
            <telerik:RadTreeView ID="RadTreeView1"  OnClientLoad="OnClientLoad" runat="server" CheckChildNodes="True" MultipleSelect="True"
                <Nodes> 
                 . . . 
                </Nodes> 
            </telerik:RadTreeView> 
        </ItemTemplate> 
        <Items> 
            <telerik:RadComboBoxItem runat="server" /> 
        </Items> 
    </telerik:RadComboBox>   

    JavaScript:
     
    <script type="text/javascript"
    var treeview; 
    function OnClientLoad(sender) 
        treeview = sender; 
    function OnClientDropDownClosing(sender, eventArgs) 
      if( sender._focused == true
      { 
          eventArgs.set_cancel(true); 
      } 
      else 
      { 
        var temp=""
        var nodes = treeview.get_selectedNodes(); 
        for (var i = 0; i<nodes.length ; i++) 
        { 
            temp = temp + nodes[i].get_text()+"; "
        } 
        sender.set_text(temp); 
      } 
    </script> 

    I am not quite sure about your second requirement. Are you resizing the dropdown on selecting the items? If so you can set the width and height by setting the properties combo._dropDownWidth and combo._dropDownHeight where combo is the clientside object of RadComboBox.

    -Shinu.
Back to Top