Remove hyperlink from Lookup column in SharePoint

For whatever reason if you don’t want users to be able to click on a lookup column in a list, there’s no straight forward method of disabling that link. Here’s the way I disable them in SharePoint 2010, and it wasn’t any different in 2007 either apart from fancy UI.

In the image below, Country is a lookup type of column


 Open the list view in SharePoint designer for modification


 Select the lookup column item and in the document map bar in the bottom, choose the context menu for “xsl:value-of”, and select “Edit Tag…”

You will see the “Edit Tag” window

The above XPath “$thisNode/@*[name()=current()/@Name]” when executed, returns the following hyper link tag

<a onclick=”OpenPopUpPage(‘http://servername/_layouts/listform.aspx?PageType=4&ListId={9CF20D94-56E4-426B-AAA3-97CEA2B23570}&ID=3&RootFolder=*’,RefreshPage); return false;”href=”http://servername/_layouts/listform.aspx?PageType=4&ListId={9CF20D94-56E4-426B-AAA3-97CEA2B23570}&ID=3&RootFolder=*”>United States</a>

In order to get the clean value which is in this case “United States”, we need to remove the decoration around it, so we are going to remove everything before ‘>‘ and after ‘<‘ by changing the tag in the Quick Tag Editor to

<xsl:value-of select=”substring-before(substring-after($thisNode/@*[name()=current()/@Name],’&gt;’), ‘&lt;’)” disable-output-escaping=”yes”>

Then press the tick button on the “Quick Tag Editor” to save the modified tag, save the page and view it in browser

Links are gone.

Neat, isn’t it?

  1. #1 by bhushanp on February 29, 2012 - 11:55 am

    thanks for such a nice article. you save my time…………..

  2. #2 by Tina on March 5, 2012 - 8:32 pm


  3. #3 by Amanda on March 13, 2012 - 1:57 pm

    When I follow your instructions and go to edit tag, the existing tag that I see is different from yours. Mine is “”. Am I looking in the wrong place? (I am using SPD 2007)

    I am new to SP Designer so please go easy on me!! 🙂

    • #4 by Aleem on March 16, 2012 - 10:37 am

      This solution is intended for SharePoint 2010, but it can be applied in 2007, you will have to work in code view though. I don’t have 2007 installed so I can’t give you a detailed solution.

  4. #5 by Josh on May 24, 2012 - 4:18 pm

    OK, this works perfectly when I go to the list directly. However, if I add the list to a page using a List View Web Part, the links are back. Any idea how to get rid of them in the web part?

  5. #6 by Amar on July 25, 2012 - 1:10 pm

    Thank. That helps 🙂

  6. #7 by premchand on December 12, 2012 - 7:07 pm

    very nice article and this really help me in one of the migration project that we are doing from WSS to SP 2010

  7. #8 by on February 6, 2013 - 2:55 pm

    Exactly how long did it require you to compose “Remove hyperlink from Lookup column in SharePoint Diary of a SharePoint Developer”?
    It contains a bunch of great tips. Many thanks -Sommer

  8. #9 by haritha on February 7, 2013 - 9:08 am

    hi,i tried this in sharepoint designer 2007.But it is not working for me.when replacing this ,data is not coming for that couln in site.
    Please let me know the reason

  9. #10 by TDV on April 12, 2013 - 7:25 pm

    Thank you … It really helps

  10. #11 by dotnetgeekster on April 15, 2013 - 10:10 am

    since you are stripping html elements away we can already not include the disable-output-escaping. thanks though!

  11. #12 by spinal surgery recovery time frame on April 19, 2013 - 12:01 pm

    Hello just wanted to give you a quick heads up.
    The words in your post seem to be running off
    the screen in Opera. I’m not sure if this is a formatting issue or something to do with web browser compatibility but I thought I’d post to
    let you know. The design and style look great though!
    Hope you get the problem fixed soon. Thanks

  12. #13 by hwr on April 26, 2013 - 2:45 pm

    How would I add a “a href “attribute for title, so that when hovering over the lookup link, we see a description?

  13. #14 by KM on June 4, 2013 - 5:49 pm

    This is fantastic.. only it doesn’t work when you have it set to allow multiple choices. It removes the link but only shows the first entry.

  14. #15 by Artem on June 27, 2013 - 12:39 pm

  15. #16 by on June 28, 2013 - 8:10 pm

    Everything is very open with a clear clarification of the challenges.
    It was truly informative. Your website is very helpful.
    Thanks for sharing!

  16. #17 by webbrewersatt on April 23, 2014 - 11:02 pm

    This is why people hate SP – if you look up the field with no link, why does a link get added? And why is there no easier way to globally adjust the look up field? Editing the tags for each item in a list is absurd.

  1. SharePoint 2010: Recopilatorio de enlaces interesantes (XXVIII)! « Pasión por la tecnología…
  2. SharePoint 2010: Recopilatorio de enlaces interesantes (XXVIII)! - Blog del CIIN
  3. Remove Hyperlink from SharePoint Lookup Columns | TAD
  4. Remove Lookup Column Link From View « The Chris Kent

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: