Posts

Showing posts from April, 2011

URL fields in SharePoint Content Query Web Part

Image
When a content query web part is used to query and display the items in the Links list, i got the output in a very undesirable format. As you can see in the image above, it is showing the URL of the link followed by a comma and then the link text. Also when you click on the link in will take you to the display form for that item in the links list instead of taking us directly to the URL of the link. So i started to modify the XSL to get the desired bahaviour which is It should show only the link text without the URL The hyperlink should point to the URL rather that the display form for that item. For this go to your site's Style Lirrary->XSL Style Sheets Download a copy of the ItemStyle.xsl I named the copy as CategoryItemStyle.xsl. Modify the content of it to this Upload the CategoryItemStyle.xsl to the Style library-> XSL Style Sheets. Then export the default the Content Query Web Part and open in it in notepad or Visual Studio Change the ItemXslLink prope

Remove hyperlink for lookup columns in SharePoint

Image
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 $thisNode/@*[name()=current()/@Name] Change it to substring-before(substring-after($thisNode/@*[name()=current()/@Name],'>'),'<') Click on OK and save the changes. Now when you go to the list, you will see the lookup values without the hyperlinks.