Sunday, December 4, 2011

SPFieldUrl: Open URL in a New Window

When I add a hyperlink column in a list and add an item, I click its hyperlink. Then, it redirects current page to the link. But, I want to open a new window when clicking these links.

In fact, I cannot configure it inside SharePoint. After Googling, I discover it can be done by the following steps:

1. Go to folder "Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\XSL"
2. Open fldtypes.xsl
3. Change line '<a href="{$url}" >' to '<a target="_blank" href="{$url}" >'
3. Save the file and restart IIS

After that, I create a new hyperlink column, it opens a new window when clicking its link.

RenderPattern Element (Field Types)
SharePoint: Creating Custom SharePoint 2010 Field Types
How to: Create a Custom Field Type
Customizing the Rendering of a Custom SPField
What's New: Custom Field Rendering Enhancements

No comments:

Post a Comment