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

TreeView in ItemTemplate is blank after binding...

2 Answers 123 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Peter From LA
Top achievements
Rank 1
Peter From LA asked on 16 Aug 2011, 07:06 PM
I used the Combobox/Template example to build a RadComboBox with a RadTreeView as an ItemTemplate, but instead of a SqlDataSource I bound the tree in C# using a List<object>. The same tree works fine when it is by itself and shows all the data correctly, but when it is inside of the Item it is BLANK - the drop down is empty.

this is my front end code:
<telerik:RadComboBox
    ID="rcbDrawing"
    Width="205px"
    Height="300px"
    AllowCustomText="true"
    EmptyMessage="Select A Drawing"
    runat="server"
    Skin="Outlook"
    >
    <ItemTemplate>
        <div onclick="StopPropagation(event)">
            <telerik:RadTreeView
                ID="treeDrawings"
                runat="server"
                DataTextField="Name"
                DataValueField="ID"
                DataFieldID="ID"
                DataFieldParentID="ParentID"
                Skin="Outlook"
                OnClientNodeClicking="OnTreeNodeClicking"
                ></telerik:RadTreeView>
        </div>
    </ItemTemplate>
    <Items>
        <telerik:RadComboBoxItem />
    </Items>
</telerik:RadComboBox>


This is how I do the binding:
RadTreeView treeDrawings = (RadTreeView)rcbDrawing.Items[0].FindControl("treeDrawings");
DrawingsCollection d = DrawingsCollection.GetByClientID(PageUser);
treeDrawings.DataSource = d;
treeDrawings.DataBind();
treeDrawings.ExpandAllNodes();

Am I doing anything wrong?

2 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 18 Aug 2011, 01:39 PM
Hi Peter,

Please take a look at the help article below. There you will find examples of how to bind the RadTreeView to an Array.
  • http://www.telerik.com/help/aspnet-ajax/treeview-data-binding-array.html

Also make sure you have set the properties DataFieldID  and  DataFieldParentID  of the RadTreeView correct as noted in the help article.

All the best,
Ivana Gjorgeva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ivan Zhekov
Telerik team
answered on 20 Feb 2013, 08:57 AM
Hello, Peter.

With this release: 2013 Q1, we are releasing the DropDownTree -- a control designed to work in a manner similar to TreeView in ComboBox.

Since you have such scenario, you might be interested. You can check the examples here -- http://demos.telerik.com/aspnet-ajax-beta/DropDownTree/Examples/Overview/Defaultcs.aspx -- or later on at the official (non-beta) site.

Regards,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Peter From LA
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Ivan Zhekov
Telerik team
Share this question
or