木子苏

导航

Content Query Webparts 返回页面

First off all you'll see that, by default, you've ContentQueryMain.xsl and ItemStyle.xsl in the ' style library/xsl style sheets ' folder.

For our purpose we have created a custom ContentQueryMainCompany.xsl

Now when you open this file you will see that at the beginning of the xsl:stylesheet he defines a lot of parameters.
You will see that there are a few wich define any url (ex. WebUrl, FeedPageUrl and SiteUrl), but he doesn't have a parameter called 'PageUrl'. So lets add that first.

<xsl:param name="PageUrl" />

Next you search till you found the ' OuterTemplate.GetSafeLink' xsl template.

Right under the first If-statement you will see something like this:

<xsl:value-of select="concat('/_layouts/CopyUtil.aspx?Use=id&amp;Action=dispform&amp;ItemId=',@ID,'&amp;ListId=',@ListId,'&amp;WebId=',@WebId,'&amp;SiteId=',$SiteId)"/>

Just place the follow parameter at it:

Source=',$PageUrl,'&amp;

I've place it right after the question mark, so my code will end up like this:

<xsl:value-of select="concat('/_layouts/CopyUtil.aspx?Source=',$PageUrl,'&amp;Use=id&amp;Action=dispform&amp;ItemId=',@ID,'&amp;ListId=',@ListId,'&amp;WebId=',@WebId,'&amp;SiteId=',$SiteId)"/>

That's it!!! When you click on an item of your content query webpart and then click on close you will be send back to the page from where you become

posted on 2010-06-03 10:46  skind@126.com  阅读(232)  评论(0)    收藏  举报