Hide New / Actions / Upload / Settings menus in SharePoint Lists / document libraries
Posted
by zikoziko
on Stack Overflow
See other posts from Stack Overflow
or by zikoziko
Published on 2009-07-22T15:35:17Z
Indexed on
2010/04/21
8:53 UTC
Read the original article
Hit count: 207
How can I hide the New / Actions / Upload / Settings menus within a list or document library in SharePoint? Note that I need to be able to hide these menus for a particular list definition (template) and not just all lists or document libraries.
One possible way that I know of is to register a , and set the ControlClass element to a control that inherits from WebControl. In the WebControl, I can override OnPreRender, which then does this:
foreach (Control control in this.Parent.Controls)
{
if (control.ToString() == "Microsoft.SharePoint.WebControls.NewMenu")
{
control.Visible = false;
}
// etc
}
This is pretty hacky, and I was just wondering if there is a better way of doing it?
© Stack Overflow or respective owner