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
xmlns:ddwrt=”http://schemas.microsoft.com/WebParts/v2/DataView/runtime”
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;

Comments

Popular posts from this blog

Sharepoint 2007 Showing outlook Inbox using outlook active X control

IIS Configuration Error Error: Cannot write configuration file due to insufficient permissions

Grails - Introduction