Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
SDK Documentation
General Reference
 How to: Hide a Menu Item in the ECB...
Community Content
In this section
Statistics Annotations (0)
This page is specific to
The 2007 product release

Other versions are also available for the following:
How to: Hide a Menu Item in the ECB from SharePoint List Items

You can add new custom actions to the Edit Control Block (ECB) menu by using the Features framework. However, you cannot use this method to do the reverse – to hide existing ECB menu items– because they are rendered by using the JavaScript file, which is core.js. Note that modifying the core.js file is not supported or recommended.

Therefore, to hide ECB menu items, you must create a customcore.js file, modify this file to hide menu items, and then render the customcore.js file through a custom master page. Note that the built-in core.js file must remain in the custom master page; for that reason, your customcore.js file should have an attribute “Defer” with the value true.

The following steps allow you to create a customcore.js file and render it through the custom master page.

Hiding ECB menu items

  1. Copy the core.js file from its default location at <%Program files %>\common files\Microsoft shared\web server extensions\12\Template\layouts\1033, place it in the same folder, and rename as customcore.js file.

  2. Make the necessary changes in the customcore.js file by removing unwanted ECB menu items.

  3. To create the custom master page, make a copy of the default.master page and rename it as custom.master.

  4. In the custom master page, add the following line to render the customcore.js file:

    <SharePoint:ScriptLink language="javascript" name="core.js" Defer="true" runat="server"/> <SharePoint:ScriptLink language="javascript" name="customcore.js" Defer="true" runat="server"/>
  5. Save the custom.master page and upload it to the master pages gallery of the site. Then apply the custom.master page as the default master page for the site.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker