简体   繁体   中英

How can I disable the context menu of a treeview?

I've created a custom section with a treeview. I want to remove the context menu that appears when you right click on the tree nodes because I don't want the user to be able to create/delete. I've been following a few tutorials on it and I've managed to remove all of the items but I'm left with an empty context menu that I can't seem to get rid of.

空上下文菜单的屏幕截图

The code to render the nodes is

public override void Render(ref XmlTree tree)
{
    XmlTreeNode xNode = XmlTreeNode.Create(this);
    xNode.NodeID = "1";
    xNode.Text = "Enquiry Form";
    xNode.Icon = "compliance.gif";
    xNode.Action = "javascript:listEnquiries()";
    xNode.Menu.Clear();        
    tree.Add(xNode);
}

You can't get rid of it, unfortunately, even if you remove the menu entirely, that thin box is still displayed.

If you could be bothered to trot through the source CSS for the back office, you might be able to add some CSS to make it not show up at all if there's no items maybe?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM