New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Disable Context Menu

In this help article you can learn how to disable the context menus of RadEditor by using either server-side or client-side approach.

Server-side Approach

To disable RadEditor context menus:

  1. In the code-behind, get the ContextMenu item/s;
  2. Set its/their Enabled property to false.

Alternatively, you can traverse the entire ContextMenus collection and disable all ContextMenu items.

Example 1: Disable context menus by using the server-side Enabled property.

<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1">
</telerik:RadEditor>
RadEditor1.ContextMenus.FindByTagName("A").Enabled = false; 
RadEditor1.ContextMenus.FindByTagName("P").Enabled = false;
RadEditor1.ContextMenus.FindByTagName("A").Enabled = False
RadEditor1.ContextMenus.FindByTagName("P").Enabled = False

Client-side Approach

In order to disable context menus through client-side script:

  1. Handle the OnClientLoad event;
  2. Use the ToolAdapter object and disable all context menus by calling the enableContextMenus() method with a boolean false parameter.

If you have enabled Track Changes feature of RadEditor, use the client-side approach.

Example 2: Disable all context menus via clinet-side script.

<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1" OnClientLoad="OnClientLoad">
</telerik:RadEditor>

<script>
    function OnClientLoad(editor, args) {
        var toolAdapter = editor.get_toolAdapter();
        toolAdapter.enableContextMenus(false);
    }
</script>

See Also

In this article