Try our conversational search powered by Generative AI!

an oldie - how to disable contextmenu right click

Vote:
 

Ok this is an old one, long forgotten but we got a customer that wants to do it. Episerver 4.x

Can someone remind me how to disable the contextmenu (right click menu in doap)?

Thanks in advance!

#24048
Sep 22, 2008 17:37
Vote:
 
#24052
Sep 22, 2008 20:52
Vote:
 

Why did you remove the RightClickMenu attribute in CMS 5? It was very useful in CMS 4. Or did it move somewhere else?

 

Example:
Example disables the menu on a template
 
[RightClickMenu(Disabled=true)]
public class StandardPage : TemplatePage
{
  (....)

 

#24059
Edited, Sep 23, 2008 0:51
Vote:
 

hi,

If you want to disable DOPE (Direct On Page Edit) you can change to inherit from SimplePage, or set the episerver property "Editable" to false.

E.g. <episerver:property propertyname="PageName" runat="server" Editable='false' />

Search in the old 4.x. sdk for "editable" and you'll get more info.

-- Per

#24074
Sep 23, 2008 13:21
Vote:
 

Unless my memory serves me wrong, wasn't there a simple change in the web.config that would turn off the right click menu completely?

We want to do it for the entire site, not just individual temples or controls.

#24107
Sep 24, 2008 12:49
Vote:
 

I thought I had it solved. There's a class one can use (or so I thought).

RightClickMenuAttribute.Current.Disabled = true;

So I put this code in Page_Load but nothing happens! The right click menu pops up all the same.

So if anyone have suceeded in turning this off for a whole site at once, please tell. 

#24294
Sep 30, 2008 14:07
Vote:
 

I got rid of the contextmenu...

I changed to inherit from SimplePage on a page where I also have a stripped fckeditor.

#24295
Sep 30, 2008 15:21
Vote:
 

I have the same issue, wanting to remove the DOPE, New and Quick-Edit options from the menu but leaving the other options.

The simple answer is to create your own class inheriting from TemplatePage and then, in hte onLoad event iterating through the ContextMenu's Items collection, switch those I don't want off.

string[] DisabledMenuOptions = WebConfigurationManager.AppSettings["DisabledMenuOptions"].Split(new char[] {'|'});
for (int i = 0; i < this.ContextMenu.Menu.Items.Count; i++ )
{
if (DisabledMenuOptions.Contains(this.ContextMenu.Menu.Items[i].Caption))
{
this.ContextMenu.Menu.Items[i].EnabledScript = "false";
}
}

 

 In theWebConfig I have an appSetting called DisabledMenuOptions set to "Edit|Save and Publish|Cancel|New|Quick-edit".

 Hope this helps?

 Jim.

 

 

#27323
Jan 26, 2009 17:31
Vote:
 

or use

ContextMenu.Options &= ~EPiServer.Web.PageExtensions.ContextMenuOption.OnPageEdit;

 

/Per

#27439
Jan 30, 2009 10:08
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.