Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

Here are two links that might help you - here and here.
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900