Spread for ASP.NET 11 Product Documentation
ContextMenu
Spread for ASP.NET 11 Product Documentation > Client-Side Scripting Reference > Scripting Members > Classes > ContextMenu

The ContextMenu class consists of the following members. You can use this class to disable a menu item on the client side.

Constructor Description
public ContextMenu(); Initializes a new instance of the ContextMenu class

Property Description
public Array Items {get;} Gets the MenuItem collection

 

Method Description
GetItem(name: string); Gets a menu item using text
SetEnabled(enabled); Sets the menu item enabled state
GetEnabled(); Gets the menu item enabled state
GetText(); Gets the menu item text

This is a sample that disables a menu item. On the client side, the script would look like this:

JavaScript
Copy Code
function onContextMenuOpening(event)
{
  var menu = event.ContextMenu;
  var copyItem = menu.GetItem("Copy");
  copyItem.SetEnabled(false);
}