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

Multiselect treeview inside DropDown

1 Answer 162 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sreedath Kuttan
Top achievements
Rank 1
Sreedath Kuttan asked on 07 Jul 2009, 06:43 PM
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)

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Jul 2009, 12:18 PM
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.
Tags
TreeView
Asked by
Sreedath Kuttan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or