Thursday, February 9, 2012

View Item Link on a SharePoint content query webpart

In standard the link in the content query webpart links directly to the view form of the selected list. If you want to open the link in the dialog framework popup just add the following click event to the link element in the xsl template of your itemstyle.xsl

<a onclick="OpenPopUpPage(this.href, RefreshPage);return false;" href="{$SafeLinkUrl}" title="{@LinkToolTip}"> Some Link Text</a>

You can leave out the second argument, but if you set it to "RefreshPage" function, the page is refreshed if someone has edited the item.

Of course, you can use this function everywhere and not only in the content query webpart if you have the link to the list item in the href attribute.

No comments: