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

[Solved] ContextMenu not binding where Node loaded in ServerSideCallBack mode

5 Answers 199 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
onit
Top achievements
Rank 1
onit asked on 19 Feb 2008, 05:13 PM
In myTtreeView do not popup needed ContextMenu with ServerSideCallBack node-expand mode. InServerSide mode all work fine :(

Code below:

 In node_Expand  Event:
(all nodes in ServerSideCallBack mode)
... 
Telerik.Web.UI.RadTreeNode node = new Telerik.Web.UI.RadTreeNode(proj.Name); 
node.ContextMenuID = "trvContextInstallation"
... 
 

On client trvContextInstallation-Context menu do not fired.

TreeView Context menus markup bellow:
                    <ContextMenus> 
                    <telerik:RadTreeViewContextMenu id="trvContextProject" runat="server" Flow="Horizontal"
                        <Items> 
                            <telerik:RadMenuItem  text="Открыть изменения проекта" Value="cmdProjOpenChanges" ExpandMode="ClientSide" runat="server"
                                <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                            </telerik:RadMenuItem> 
                        </Items> 
                        <DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                        <ExpandAnimation Type="OutQuart" /> 
                    </telerik:RadTreeViewContextMenu> 
                    <telerik:RadTreeViewContextMenu id="trvContextInstallation" runat="server" Flow="Horizontal"
                        <Items> 
                            <telerik:RadMenuItem  text="Открыть изменения инсталляции" Value="cmdInstallationOpenChanges" ExpandMode="ClientSide" runat="server"
                                <GroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                            </telerik:RadMenuItem> 
                        </Items> 
                        <DefaultGroupSettings ExpandDirection="Auto" Flow="Vertical" /> 
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                        <ExpandAnimation Type="OutQuart" /> 
                    </telerik:RadTreeViewContextMenu>                     
                    </ContextMenus>                     
 

5 Answers, 1 is accepted

Sort by
0
Jim
Top achievements
Rank 1
answered on 19 Feb 2008, 05:32 PM
I just came across the same problem this morning too.  Same exact situation.  The root nodes context menu works fine but the sub nodes seem to have a few outcomes.

If I specify the same contextmenuid on all the nodes then the root nodes show the menu but the others all show the default browser menu.

If I specify "" as the contextmenuid on all the nodes then I get the first context menu.

If I specify a contextmenu on the nodes immediately under the root nodes, Level1, and none of the others I get the first contextmenu on all of the nodes other than Level1.  Level1 nodes have the default browser menu.

One feature I'd like to see is a way to block the right click all together on a node.  There are times when I don't want a node to have a context menu and theres not a clean way to do that right now.
0
Accepted
Simon
Telerik team
answered on 22 Feb 2008, 04:43 PM
Hello Nadya,

I tested this with a simple RadTreeView, which nodes were added via ServerSideCallback and used the context menus defined in your post. It worked normally. I also used the latest version of Web.UI. Please find attached the project, download it and give it a try. If it works on your side, maybe you should try downloading the latest version of "Prometheus" controls.

I would like to add that you could disable the context menu for any given node by settings its EnableContextMenu property to false.

I hope this helps.

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
onit
Top achievements
Rank 1
answered on 24 Feb 2008, 10:31 AM
Thank's.

Did not work because of version 1.7.0.0 use.
0
Don
Top achievements
Rank 1
answered on 07 Mar 2008, 07:32 PM
I am having this problem, but the difference is that I am dynamically creating the context menus inside of the treeview_NodeExpand event handler.  I am using the latest version of Prometheus (2007.3.1425.35 VS2008).  I had the same problem with the last build(2007.3.1314.20 VS2005).  If I create a menu in the Page_Load and reference it from the NodeExpand handler it works ok, but I can't get my dynamic menus that way.

Thanks,
Don

code example:
                      
protected void tvAccounts_NodeExpand(object o, Telerik.Web.UI.RadTreeNodeEventArgs e)  
    {  
     ...  
       // Loop through some "service" objects adding nodes with context menus:  
       Telerik.Web.UI.RadTreeViewContextMenu serviceMenu = new Telerik.Web.UI.RadTreeViewContextMenu();  
       serviceMenu.ID = "scm" + service.UniqueID;  
       Telerik.Web.UI.RadMenuItem changeItem = new Telerik.Web.UI.RadMenuItem("Add or Remove Products");  
       changeItem.Value = "changeprods";  
       serviceMenu.Items.Add(changeItem);  
 
       Telerik.Web.UI.RadMenuItem cancelItem = new Telerik.Web.UI.RadMenuItem("Cancel Service");  
       cancelItem.Value = "cancel";  
       serviceMenu.Items.Add(cancelItem);  
 
       tvAccounts.ContextMenus.Add(serviceMenu);  
 
       serviceNode.ContextMenuID = "scm" + service.UniqueID;  
      ...  
   } 
0
Nikolay
Telerik team
answered on 10 Mar 2008, 09:04 AM
Hello Don,

RadContextMenus cannot be entirely added at the client-side. Since the ServerSideCallBack mechanism works entirely at the client-side, context menus are not properly added to the ContextMenus collection of the treeview object.
You can, however, add items to predefined menus or simply predefine the menus and set the ContextmenuID property of a node in its NodeExpand event.

Hope this helps.

Regards,
Nick
the Telerik team

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