title: Hide New / Actions / Upload / Settings menus in SharePoint Lists / document libraries
body: <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>foreach (Control control in this.Parent.Controls)
  {
      if (control.ToString() == "Microsoft.SharePoint.WebControls.NewMenu")
      {
          control.Visible = false;
      }
  
      // etc
  }
  </code></pre>
  
  <p>This is pretty hacky, and I was just wondering if there is a better way of doing it?</p>