Saturday, April 2, 2011

Remove hyperlink for lookup columns in SharePoint

I tried to look for how to remove the hyperlink for the lookup columns in SharePoint. I was expecting some kind of an XSL transformation. But all the posts i found in the internet were using JavaScript for this functionality.  So i decided to work on the XSLT myself. I know this is a much cleaner and efficient solution. And this is how it is done.

I have a list with a lookup column called "DeptLookup". To remove the hyperlink follow the below mentioned steps

Open this list in SharePoint designer. Click on the AllItems.aspx to open it.
Select the lookup column

Click on the formula on the ribbon
This will open a dialog for you called Insert formula
The default formula for the lookup column is


Change it to


Click on OK and save the changes. Now when you go to the list, you will see the lookup values without the hyperlinks.

If you want to remove the hyperlink for the item display form, create a new display form in SharePoint designer and follow the same procedure until you get the Insert Formula dialog.
In the dialog give the value as


where DeptLookup is the name of the lookup column.

What we have done here is a very simple concept. The lookup columns are nothing but hyperlinks

<a href=something>LookupValue</a>

We have chopped down the portion after >
From the resulting string we have removed the part after <
which will leave us with just the value we want LookupValue


  1. If we have single lookup item, its working. But if we have multiple item its not working

    1. Try to use this alternative solution: It has option to display lookup values as links or as generic text.

  2. Yes this logic works only for a single lookup value. If your column is configured to have multiple lookup values, this logic does not hold good.

  3. Works well! Just what I need. Will add a slight modification. The LessThan sign needs to be escaped (at least for SP2016) with <

    Here's the code I use to remove the link from Department lookup: