Remove hyperlink from Lookup column in SharePoint 2010 List

1. Here in below example country is a look up column, to disable the hyperlink follow the below procedure

 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

3 comments: