views:

1182

answers:

1

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 treeview node that work.) Once the node has been expanded, the collapse button doesn't work, 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 works properly.

I really need the control to work with ExpandMode set to serverside, to reduce the loading for large Tree's.

Im not sure if this matters. But I am adding the Events to the RadTreeview when the event RadGrid_ItemDataBound is fired. I am noticing one strange behavior, that I cannot explain either, 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 into the tree.

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 decleration of the Treeview in the ascx file

<DetailTables>
    <telerik:GridTableView Name="Detail Table" ShowHeader="false">
    <Columns>                               
        <telerik:GridTemplateColumn UniqueName="FooTreeview">
            <ItemTemplate>
                <telerik:RadTreeView ID="RadTreeView1" runat="server" DataValueField="CommunicationID"
                    LoadingStatusPosition="BelowNodeText" style="white-space: normal;">
                    <NodeTemplate>
                        <uc1:FooControl ID="r1" runat="server" FooBindings='<%#DataBinder.Eval(Container,"DataItem") %>' />
                    </NodeTemplate>
                </telerik:RadTreeView>
            </ItemTemplate>
        </telerik:GridTemplateColumn>                           
    </Columns>
    </telerik:GridTableView>
</DetailTables>
+1  A: 

try adding your events to the RadGrid ItemCreated.

FiveTools
That fixed it! Thanks
Aaron M