Friday, July 9, 2010

Connectable Page Viewer Web Part in Sharepoint !

Project Description
This Connectable Page Viewer Web Part is a WSS/MOSS page viewer web part that can be connected to another web part as a consumer. Values received from the connected web part can then be substituted in a URL template specified in the web part configuration.

This is based on code originally written by Todd Baginski at http://www.sharepointblogs.com/tbaginski/archive/2007/08/16/connected-page-viewer-web-part.aspx.

Todd's web part consumed an entire URL from the connection. This web part takes individual data elements and allows substitution of them into a URL template.

The substitution can be done positionally (ex: {1} {2} {3}) or by name (ex: {Title} {City} {State}).

For example, let's say you have a site with a list containing city and state names. You can drop a list view web part on a page, then add this Connectable Page Viewer web part on the page and connect the list view web part to the Connectable Page Viewer web part. The list view web part will provide values to the Connectable Page Viewer web part and those values can be substituted in the URL.

The Connected Page Viewer web part might have it's URL set to:

http://search.live.com/results.aspx?q={1}+{2}

When a city/state is selected in the list view web part, the city and state names will be sent via the connection to the Connectable Page Viewer web part, resulting in it displaying this URL (for example):

http://search.live.com/results.aspx?q=Philadelphia+Pennsylvania

Assuming the state name is in the list column named "State" and the city name is in the column "City", the URL could also have been:

http://search.live.com/results.aspx?q={City}+{State}

This can be used with any web part that provides a cell or row via a connection.

The URL template can reference data received via the connection by position using the column number in braces. The first column is denoted by {1}, the second by {2}, etc. The URL template can also reference them by column name, in braces. For example, {City}, {State}.

Another example: Let's say you have a SQL Reporting Services report that takes two parameters, City and State. You could view the report in the Connectable Page Viewer web part by setting the URL to:

http://reports.mydomain.com/ReportServer/Pages/ReportViewer.aspx?/MyReports/GeographyReport&rs:Command=Render&rc:LinkTarget=_blank&State={State}&City={City}&rc:parameters=collapsed

Note: If the web part connected to the Connectable Page Viewer web part does not initially provide any data when the page is first displayed, the web part will not navigate to any URL. It will not create the frame until data is provided to it.

cpv.jpg
 

Configuring Reporting Services Reports in SharePoint

No comments:

Post a Comment