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

[Solved] RadTreeView inside (Tree expand/collapse doesnt work)

2 Answers 233 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron Mell
Top achievements
Rank 1
Aaron Mell asked on 09 Feb 2010, 09:42 PM
I have a Radtreeview that sits inside a RadGrid. For some reason the expand/collapse buttons of the Treeview are not working. I can expand the Treeview initially, however the NodeExpand event never fires.(a postback does occur to the server, and I have several buttons on the node that work also.) Once the node has been expanded, the collapse button stops functioning, and clicking on it does nothing.(no postback to server). I have the ExpandMode set to ServerSide. However, if I change the Expandmode to Clientside it continues to work. I really need the control to work with ExpandMode set to serverside, to reduce the loading for large Tree's

2 Answers, 1 is accepted

Sort by
0
Aaron Mell
Top achievements
Rank 1
answered on 09 Feb 2010, 11:37 PM
Im not sure if this matters. But I am adding the Events to the RadTreeview when the event RadGrid_ItemDataBound is fired

this code is from the RadGrid_ItemDataBound event
RadTreeView tree = (RadTreeView)e.Item.FindControl("RadTreeView1"); 
                tree.NodeDataBound += new RadTreeViewEventHandler(RadTreeView1_NodeDataBound); 
                tree.NodeExpand += new RadTreeViewEventHandler(RadTreeView1_NodeExpand); 
                tree.NodeCollapse += new RadTreeViewEventHandler(tree_NodeCollapse); 


Here is the Grid template Column I am using in the ascx
<telerik:GridTemplateColumn UniqueName="DiscussionTreeview"
                                <ItemTemplate> 
                                    <telerik:RadTreeView ID="RadTreeView1" runat="server" DataValueField="FooID" 
                                        LoadingStatusPosition="BelowNodeText" style="white-space: normal;"
                                    </telerik:RadTreeView> 
                                </ItemTemplate> 
</telerik:GridTemplateColumn>     


I am noticing one strange behavior, that I cannot explain, if I do not attach an event to NodeExpand  It fails to open or close. Also the NodeDataBound event fires successfully and the data is loading fine.
0
Aaron Mell
Top achievements
Rank 1
answered on 10 Feb 2010, 03:59 PM
the problem was because I was adding the event in ItemDataBount, I moved the events to ItemCreated event, and everything started working properly.
Tags
Grid
Asked by
Aaron Mell
Top achievements
Rank 1
Answers by
Aaron Mell
Top achievements
Rank 1
Share this question
or