ImageGear .NET - Updated
Removing a Context Menu Item from Any Level of Context Menu
User Guide > How to Work with... > Common Operations > Viewing > Viewing Using ASP.NET > [Legacy] Displaying Images Using Legacy ASP.NET > Context Menu Customization > Removing a Context Menu Item from Any Level of Context Menu

Context menu items can be removed from any context menu level. The same ContextMenu class is used for menu organization. The following example demonstrates the removal of context menu items from the second level of a context menu.

For Ajax server users, please comment out the first portion of the code below and uncomment the second.

Example
Copy Code
// get PageView control with "pluginPageView" identifier from the HTML page in jQuery plugin
var pageView = $("#pluginPageView").ImGearPageViewPlugin();
// get PageView control with "pluginPageView" identifier from the HTML page for Ajax server
//var pageView = $.find("pluginPageView");
// get context menu for image and HandPan mouse tool
var topLevelContextMenu = pageView.getContextMenu(null, ImageGear.Web.UI.MouseTool.HandPan);
// get mouse tool menu
var secondLevelContextMenu = topLevelContextMenu.get(4).contextMenu;
// remove items creating the marks
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
secondLevelContextMenu.remove(5);
// set the renew context menu for RectangleZoom mouse tool
pageView.setContextMenuForTool(topLevelContextMenu, null, ImageGear.Web.UI.MouseTool.HandPan);