an oldie - how to disable contextmenu right click

 

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
  • Member since: 1996
  • Member since: 1998
     

    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
  • Member since: 2006
     

    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
  •  

    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
  • Member since: 2001
     

    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
  • Member since: 2008
     

    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
  • Member since: 2007
     

    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
  • Member since: 2006
     

    or use

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

     

    /Per

    #27439 Jan 30, 2009 10:08