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

Items and Itemtemplate

1 Answer 74 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
KevinMc
Top achievements
Rank 1
KevinMc asked on 17 Oct 2008, 06:44 PM
I have implemented using the examples in the forum a combobox with a treeview in the itemtemplate. The problem i am having is that the Itemtemplate consumes the entire dropdown area and the "all categories" item i have is not available in the dropdown list. I am using the dropdowns as filters so i need the user to be able to clear the selection. See example below. The "all categories" item is displayed in the combo text box on initial load. When the combo is expanded "all categories" is not a selecteble item. Once the user selects a category there is no way for them to reset the filter to "all categories". Is this by design?

<telerik:RadComboBox ID="comboCategories" runat="server" Height="400px" Style="vertical-align: top;" 
                Width="200px"
                <ItemTemplate> 
                    <div id="divCategories"
                        <telerik:RadTreeView ID="treeCategories" runat="server" DataFieldID="ID" DataFieldParentID="ParentID" 
                            EnableViewState="true" DataSourceID="sqlDocCategories" DataTextField="Name" DataValueField="ID" 
                            OnClientNodeClicking="categoryClicking"
                        </telerik:RadTreeView> 
                    </div> 
                </ItemTemplate> 
                <Items> 
                    <telerik:RadComboBoxItem Text="All Categories" Value="" /> 
                </Items> 
            </telerik:RadComboBox> 

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 20 Oct 2008, 03:08 PM
Hi KevinMc,

When you open the combobox, the item All Categories gets replaced by the ItemTemplate (the Treeview in your case). This is the expected behavior.
What you can do is the following: create the template at runtime, create one combobox item - and assign the template to that item, then create a second combobox item (All Categories) and do not assign a template to it.

I have created a small test project which demonstrates how to achieve that. Please download it and give it a try.

All the best,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
KevinMc
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or