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

populating treeview inside combo

2 Answers 55 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 22 Aug 2008, 07:57 PM
I have a treeview inside my combo box.
I want to populate the tree view on initial page load.

I am unable to find the tree view inside combo.

I call this code on page load:

private

void LoadRootNodes(string currentUserContext)

{

DataTable data = new DataTable();

data =

BO.GetOwners(currentUserContext,);

RadTreeView tvOwner = (RadTreeView)RadComboBox1.FindControl("tvOwner");

tvOwner.DataTextField = "Name";
tvOwner.DataFieldID = "EmpId";
tvOwner.DataFieldParentID = "ParentId";

tvOwner.DataSource = data;
tvOwner.DataBind();

}


and below is my combo declaration:

<

telerik:RadComboBox ID="RadComboBox1" runat="server" Height="140px" Width="215px" ShowToggleImage="True" Skin="WebBlue" Style="vertical-align: middle;">
    <ItemTemplate>
            <div id="div1">
                    <telerik:RadTreeView runat="server" ID="tvOwner"     OnNodeExpand="tvOwner_NodeExpand" Skin="WebBlue">
                    </telerik:RadTreeView>
            </div>
    </ItemTemplate>
    <Items>
        <telerik:RadComboBoxItem Text="" />
    </Items>
</telerik:RadComboBox>

when i do RadComboBox1.FindControl("tvOwner") my treeview comes as null.

 Please suggest.

2 Answers, 1 is accepted

Sort by
0
newbie
Top achievements
Rank 1
answered on 22 Aug 2008, 08:57 PM

I got it working.

I had to find it with the Items[0].FindControl

RadTreeView

tvOwner = (RadTreeView)RadComboBox1.Items[0].FindControl("tvOwner");

0
allan
Top achievements
Rank 1
answered on 08 Oct 2008, 10:53 PM
thank you for posting this
Tags
ComboBox
Asked by
newbie
Top achievements
Rank 1
Answers by
newbie
Top achievements
Rank 1
allan
Top achievements
Rank 1
Share this question
or