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

Treeview update problem

1 Answer 61 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Henrik asked on 19 Apr 2010, 10:07 AM

I have this setup:

A page containing a RadToolBar and a user control containing a RadTreeView:

<abc:TreeView ID="tvEmner" runat="server" /><!-- User control containing a telerik:RadTreeView control --> 

In the usercontrol, the radtreeview is declared like this:

<asp:Panel ID="pnlEmner" runat="server"
<tel:RadTreeView ID="tvEmner" EnableDragAndDrop="true" Width="300px" Height="250px" 
                                 OnNodeDrop="OnEmneDropped" OnNodeClick="OnEmneClicked" OnNodeExpand="OnEmneExpanded" 
                                 OnClientContextMenuItemClicking="onEmneContextMenuItemClicking" OnClientContextMenuShowing="onEmneContextMenuShowing" 
        <tel:RadTreeViewContextMenu ID="cmRoot" runat="server"
        <tel:RadMenuItem Value="Create" PostBack="false" Text="Opret emne"
      <CollapseAnimation Type="none" /> 
        <tel:RadTreeNodeBinding Expanded="True" /> 

I have the following scenario:
1. The user selects a node in the treeview
2. The user clicks a "Add node" button in the toolbar.
3. The toolbar client side-opens a modal window (radwindow) , in which the name of the new node is entered.
4. When the modal window closes, the treeview should be reloaded to reflect that the new node has been added

To do this, the page calls this JavaScript in the usercontrol containing the treeview:

var node = Al.EmneTreeView.getSelectedNode(); // function that gets the selected node 

I know that the node is added to the datasource for the tree view and I can see that the JavaScript code is executed. However, the list of nodes is not reloaded in the GUI.

I have also implemented the option to add nodes through a right-click context menu. In this scenario, everything works fine.
I have tried to add the user control to the radajaxmanager proxy, with no success, like this:

<tel:RadAjaxManagerProxy ID="PageAjaxManager" runat="server"
            <tel:AjaxSetting AjaxControlID="tbButtons"
                    <tel:AjaxUpdatedControl ControlID="tbButtons" /> 
                    <tel:AjaxUpdatedControl ControlID="tvEmner" LoadingPanelID="AjaxLoadingPanel" /> 

Since it works in the context menu scenario, I assume it has something to do with the toolbar not having "access" to update the radtreeview in the user control.

I hope someone can help me with this. Any help will be appreciated.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 20 Apr 2010, 01:57 PM
Hi Henrik,

I tried the provided code with some modifications and it worked without a problem, you don't need to use RadAjaxManager, because when ExpandMode is set to ServerSideCallBack, it uses its built-in ajax mechanism. I've attached my test page,  please download it and give it a try.

All the best,
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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question