Skip to content

How to remove the List View web part Title Bar link

January 30, 2012
Problem

You have a List View web part on a page. It’s Title Bar contains the name of the related list as a link. You want to remove the link and leave only a label in the Title Bar.

Try 1

The first idea is Modify Web Part Properties and clear the Title URL field value in the Appearance section. Click OK and first it works ok. But after reloading the page SharePoint automatically fills the Title URL property with the URL of the default view of the list and the link comes back. 😦

Try 2

A workaround can be replacing the Title URL value with a “#”. In this case the link will not disappear but it will point to the actual page. Better, but still far from good. :S

Try 3

The second workaround can be setting the Title URL value with “http://about:blank”. This will still render the title as link but nothing will happen when the user clicks on it. Unfortunately it can be quite misleading for users especially if you have different styles for link than labels (color, underline, hover, etc) :l

Solution

The best solution I can think of is setting Title URL value with some special string such as “###” and using a simple JavaScript or jQuery to remove all the links which point to this string:

The following jQuery will do it. Don’t forget to include a reference to the jQuery library if you haven’t done so.

jQuery(document).ready(function () {

       $('a').filter("[href='###']").each(function () {
       	$(this).replaceWith($(this).html());
       });

 });

🙂

Advertisements
4 Comments
  1. Lfeug permalink

    For me, i added the link of the current page so if someone clik on it, it’s going to stay here

  2. dugutigi permalink

    Hello. I’ve been searching all over for a solution like this. Can you provide the JavaScript equivalent of your JQuery? I already have a couple of javascripts running via a Content Editor WebPart. I’d like simply to add to it. I’m not sure I have the rights to implement JQuery. Thanks!

  3. Jennifer permalink

    Thank you. Where do we put the jQuery code?

    • Put it in your materpage or in a. Js file thatis referenced from all of your pages.
      Alternatively, if you need in on one page only, you can use a content editor web part and add the jQuery as the (HTML) content of the webpart.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: