Click here to Skip to main content
14,239,386 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

Has anyone successfully implemented a node specific context menu on a treeview in any web project?

I have populated context menu on specific treenode and able to get the treenode tagname, but i am not able to select the tree node while i right click on the treenode.

My code is as follows:

function ShowContextMenu()
        {
            var obj = window.event.srcElement;
            if(obj.tagName == "SPAN")
            {
                showhide('ctl00_menuHover','true',obj.tagName);//function to show/hide menu
            }
        }


<asp:treeview id="trvMenu" runat="server" datasourceid="SiteMapDataSource1" xmlns:asp="#unknown">
                                    CollapseImageToolTip="Collapse" ExpandImageToolTip="Expand" 
                                    ShowLines="True" oncontextmenu="Javascript:ShowContextMenu();return false;">
                                </asp:treeview>


Can somebody help me show the node as selected when i do right click?

Regards,
Snigdha
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Here are two links that might help you - here and here.
   
Comments
sargamlucy 10-Jul-10 5:13am
   
Hi Abhinav, Thanks for your help. But the codeproject solution uses ajax, which I am not allowed to use here. And the other solution I had applied previously, but it dint work. Now i directly added context menu, but still it is not working. Problem is if i hardcode the nodes, then it is working fine, but while binding from the sitemap, it does not show any hand cursor while i mouse over on tree node. and also if i do right click, the node is not getting selected.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100