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

nothing display under itemtemplate

1 Answer 123 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
appdev
Top achievements
Rank 1
appdev asked on 12 Jul 2009, 12:31 PM
i'm trying to do this and i have nothing display in the listbox . so how do i fix that. and then eventually i want to be able to move that a childnode in the tree in radlist to second radlist. the seocond radlist does not need to have a tree. so if the childnode in radtree in radlist1 get transfer over to radlist2, it will just be an item in radlist2. but i want to be able to move that item back to the childnode in radtree in radlist1 too. so how do i do that in a radtree in radlistbox. i think i might be better off with just radtree. but how do i reorder radtree or do transfer or double click just like radlistbox. or better yet can you change an item background or forecolor in radlist? can you help me  please. thanks.
<telerik:RadListBox align="left" Height="200px" AllowTransferOnDoubleClick="true"   
     AllowTransfer="true" AllowTransferAll="true" TransferToID="RadListBox2"   
     Width="300px" ID="RadListBox1" runat="server" SelectionMode="Multiple" >  
           <ItemTemplate>  
                <telerik:RadTreeView ID="test" runat="server">  
                     <Nodes>  
                        <telerik:RadTreeNode runat="server" Text="South America" Expanded="true">  
                             <Nodes>  
                                  <telerik:RadTreeNode runat="server" Text="New Brazil">  
                                  </telerik:RadTreeNode>  
                                  <telerik:RadTreeNode runat="server" Text="Rio de Janeiro">  
                                  </telerik:RadTreeNode>  
                             </Nodes>  
                        </telerik:RadTreeNode>  
                     </Nodes>  
                </telerik:RadTreeView>  
           </ItemTemplate>  
</telerik:RadListBox> 

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 14 Jul 2009, 01:28 PM
Hello Duy,

Nothing is shown in this case because the listbox does not have any items - please add one:

<telerik:RadListBox align="left" Height="200px" AllowTransferOnDoubleClick="True" 
    AllowTransfer="True" AllowTransferAll="true" TransferToID="RadListBox2" Width="300px" 
    ID="RadListBox1" runat="server" SelectionMode="Multiple" Skin="Forest"
    <ItemTemplate> 
        <telerik:RadTreeView ID="test" runat="server"
            <Nodes> 
                <telerik:RadTreeNode runat="server" Text="South America" Expanded="true"
                    <Nodes> 
                        <telerik:RadTreeNode runat="server" Text="New Brazil"
                        </telerik:RadTreeNode> 
                        <telerik:RadTreeNode runat="server" Text="Rio de Janeiro"
                        </telerik:RadTreeNode> 
                    </Nodes> 
                </telerik:RadTreeNode> 
            </Nodes> 
        </telerik:RadTreeView> 
    </ItemTemplate> 
    <Items> 
        <telerik:RadListBoxItem /> 
    </Items> 
</telerik:RadListBox> 

If you add another listbox item - the treeview will be doubled since the ItemTemplate will be applied for all items. So, if you have just one listbox item - the reordering will not work. You can reorder the nodes of the treeview by using drag and drop and EnableDragAndDropBetweenNodes = true

In addition the treeview supports OnClientDoubleClick event so you can subscribe to it and perform the necessary actions.

Regards,
Veselin Vasilev
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.
Tags
ListBox
Asked by
appdev
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or