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],’>’), ‘<’)” 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?





[...] Remove hyperlink from Lookup column in SharePoint [...]
SharePoint 2010: Recopilatorio de enlaces interesantes (XXVIII)! « Pasión por la tecnología…
February 1, 2012 at 7:46 pm
[...] Remove hyperlink from Lookup column in SharePoint [...]
SharePoint 2010: Recopilatorio de enlaces interesantes (XXVIII)! - Blog del CIIN
February 1, 2012 at 7:46 pm
thanks for such a nice article. you save my time…………..
bhushanp
February 29, 2012 at 11:55 am
Nice!
Tina
March 5, 2012 at 8:32 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!!
Amanda
March 13, 2012 at 1:57 pm
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.
Aleem
March 16, 2012 at 10:37 am