Hide New / Actions / Upload / Settings menus in SharePoint Lists / document libraries
- by zikoziko
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?