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:
- In the code-behind, get the ContextMenu item/s;
- Set its/their
Enabled
property tofalse
.
Alternatively, you can traverse the entire ContextMenus collection and disable all ContextMenu items.
<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:
- Handle the OnClientLoad event;
- Use the ToolAdapter object and disable all context menus by calling the
enableContextMenus()
method with a booleanfalse
parameter.
If you have enabled Track Changes feature of RadEditor, use the client-side approach.
<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>