Friday, May 10, 2013

How To Hide The Add New Item Link On The Bottom Of Lists & Libraries


How to Hide the Add New Item Link on the Bottom of Lists & Libraries (per view)

Why on earth would we want to hide the “add new item link” on the bottom of lists and libraries!  One very good reason to hide this link is due to multiple content types and the fact that this link will only give the new form for the default content type.  We can have our users submit new items either through the ribbon or navigation that we create.  I will base this tutorial on the example I proposed in an earlier post “An Example of When to Use Multiple Content Types for a List” which essentially has an HR Question Repository with a content type for each HR Question Type being submitted.

In order to hide this link you will need:
  •  SharePoint Designer or a Content Editor Web Part on the page
  • This code snippet

<style>
 td.ms-addnew { display:none; }
 </style>

Steps
1. Open SharePoint Designer
2.Open the List/Library which needs the link hidden
3. Right Click the view you would like to hide the link for
4. Select “Edit File in Advanced Mode”


5. Place the code between your asp:content tags for “PlaceHolderBodyAreaClass”

6. Save
7. View Your Results!

Regards,
Dan



4 comments:

  1. Replies
    1. Sure thing Harry, thanks for checking out the post!

      Delete
  2. Hi Dan, Thank you. I am now finally getting to grips with the concept of Content Types. But why would you not use the default web part setting: "No Toolbar"?

    ReplyDelete
    Replies
    1. Hi Ellenvanaken,

      Sorry for the extremely late response, this comment slipped through the cracks! I wrote the article since it might be useful to use this technique for custom page layouts. For instance I have a custom page layout for a single area and I only want users to create items via the top nav menu since I can link directly to the new form for multiple content types and the add new will open your default content type. Since I know that I only want users on these pages to use the top nav to submit items, I have dropped this style on the page layout so I don't need to update each webpart for every page where I have list views.

      Best Regards,
      Dan

      Delete