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

RunTime treeview doesn't expand

3 Answers 65 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Jean-Marc Windholz
Top achievements
Rank 1
Jean-Marc Windholz asked on 30 Mar 2010, 01:55 PM

In  RadPanelBar1_ItemDataBound event I create a redtreeview (at runtime)

Dim item_TreeView As New RadTreeView

item_TreeView.ID = "item_TreeView"

item_TreeView.DataSourceID = "ObjectDataSource2"

item_TreeView.DataFieldID = "IDCategory"

item_TreeView.DataFieldParentID = "IDParent"

item_TreeView.DataTextField = "Name"

item_TreeView.DataValueField = "IDCategory"

item_TreeView.Skin = "Default"

item_TreeView.ExpandAllNodes()

itemPanel.Controls.Add(item_TreeView)

----------------

My goal is to expand all tree nodes, despite this

item_TreeView.ExpandAllNodes()

it doesn’t happen, it remains collapsed

How can I do that?

Thank you so much

 

 

 

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Mar 2010, 02:53 PM

Hello,

Try attaching 'OnDataBound' event to dynamically created treeview and try the code for expanding all the nodes.

CS:

 
    void RadTreeView1_DataBound(object sender, EventArgs e)  
    {  
        (sender as RadTreeView).ExpandAllNodes();  
    } 

-Shinu.

0
Jean-Marc Windholz
Top achievements
Rank 1
answered on 31 Mar 2010, 08:32 AM
Can you give me an example?
how do I call the event 'OnDataBound' of the tree that I created dynamically?
thanks!
0
Veselin Vasilev
Telerik team
answered on 02 Apr 2010, 09:51 AM
Hello Jean-Marc Windholz,

Here is how you can subscribe to the DataBound event of the treeview at runtime:

item_TreeView.DataBound += new EventHandler(RadTreeView1_DataBound);


Kind regards,
Veskoni
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
PanelBar
Asked by
Jean-Marc Windholz
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jean-Marc Windholz
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Share this question
or