Friday, July 31, 2009

Customize content query web part title link to redirect to source after pressing close on detail button

I observed that whenever we use content query web part and try to browse for the list detail page. It will come back to View All page of list instead of going back to where it was coming from.
I resolved it by doing following small changes in XSL style of content query web part to fix this as per my requirement and making it consistent with other list options.

Create custom style Please refer my earlier post "How to add a new indicator in a Content Query Web Part" for details of customization and before following these step

1. Edit ItemStyle.xl
2. Add following name space at the to
3. Add <xsl:param name=”PageUrl” /> just after name space declarations.
This will define a variable Page URL and populate it with current page URL
4. In your custom template add following line before processing of title
<xsl:variable name=”CustomPageLink” select=”concat($SafeLinkUrl,’&amp;Source=’,$PageUrl)” />
This will creat a new variable custom page link and add append current page url stored previously
5. Change SafeLinkURL with CustomPageLink in your title hyperlink.
<a href=”{$CustomPageLink}” mailto:title=”%7B@LinkToolTip%7D”&gt;

No comments:

Post a Comment