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

[Solved] ContextMenus and ServerSideCallback

5 Answers 184 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
ashalan
Top achievements
Rank 1
ashalan asked on 31 Dec 2007, 08:51 AM
Hello,

I tried for quite a bit of time, but cannot seem to get context menus working in collaboration with Nodes that are populated with ServerSideCallback.

Can context menus be used with such nodes at all? Or am I simply missing something?

5 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 02 Jan 2008, 07:54 AM
Hi ashalan,

I prepared a small and running project for you that shows ContextMenus working with nodes added via ServerSideCallBack. Attached, please find the files. Download them and give them a go.

Hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
ashalan
Top achievements
Rank 1
answered on 03 Jan 2008, 08:19 AM
Thanks a lot for the demo projekt. Unfortunately, it is still not working.

What you did was adding a context menu to declaratively defined nodes:

<telerik:RadTreeView  
                ID="RadTreeView1"  
                runat="server"  
                LoadingStatusPosition="BeforeNodeText" OnContextMenuItemClick="RadTreeView1_ContextMenuItemClick" OnNodeExpand="RadTreeView1_NodeExpand"
                <Nodes> 
                    <telerik:RadTreeNode runat="server" ExpandMode="ServerSideCallBack" Text="Root RadTreeNode 1" ContextMenuID="ContextMenu1"
                    </telerik:RadTreeNode> 
etc ... 

However, if you add a node inside the the OnNodeExpand event handler, it won't work. Try the following code and you will notice how the context menu IS displayed for the node that was added declaratively, but not working for any node added via ServerSideCallback.

ASPX Code Snippet
        <telerik:radtreeview id="RadTreeView1"  
            runat="server"  
            OnNodeExpand="RadTreeView1_NodeExpand1"  
            CausesValidation="False"   
            EnableViewState="True"  
            PersistLoadOnDemandNodes="False" > 
            <CollapseAnimation Duration="1" Type="Linear" /> 
            <ExpandAnimation Duration="1" Type="Linear" /> 
            <Nodes> 
                <telerik:RadTreeNode runat="server" ExpandMode="ServerSideCallBack" Text="TestNode" ContextMenuID="ctmFindRefresh"></telerik:RadTreeNode> 
            </Nodes> 
            <ContextMenus> 
                <telerik:RadTreeViewContextMenu ID="ctmFindRefresh" runat="server"
                    <Items> 
                        <telerik:RadMenuItem Text="Item1"></telerik:RadMenuItem> 
                        <telerik:RadMenuItem Text="Item2"></telerik:RadMenuItem> 
                    </Items> 
                </telerik:RadTreeViewContextMenu> 
            </ContextMenus> 
        </telerik:radtreeview> 
Code Behind:

        protected void RadTreeView1_NodeExpand1(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) 
        { 
            RadTreeNode newnode = new RadTreeNode(); 
            newnode.Text = "New Node"
            newnode.ContextMenuID = "ctmFindRefresh"
            newnode.ExpandMode = TreeNodeExpandMode.ServerSideCallBack; 
            e.Node.Nodes.Add(newnode); 
        } 
0
Nikolay
Telerik team
answered on 03 Jan 2008, 09:11 AM
Hello ashalan,

We verified the problem. This appears to be a bug in the treeview control. Our developers are aware of it and they will solve the problem with the SP1 release due in the second half of this month. We apologize for the inconvenience this is causing you and we hope that this timeframe is acceptable for you.

Your Telerik points have been updated for your report.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
ashalan
Top achievements
Rank 1
answered on 03 Jan 2008, 09:28 AM
If I may say so: amazing customer support. Issue turn-around is almost faster than I can check the forums :)
0
Nikolay
Telerik team
answered on 03 Jan 2008, 12:05 PM
Hi ashalan,

Thanks for the kind words. Preparing a fix is always better than a promise to build such. We will be doing our best to include it in the forthcoming SP1 release.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
ashalan
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
ashalan
Top achievements
Rank 1
Share this question
or