The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Susan Harkins (424) [Avatar] Offline
Chapters 1, 2 and 3 have arrived! Be one of the first to read and comment on this manuscript.
bijayani (2) [Avatar] Offline
Re: SharePoint 2010 Web Parts in Action MEAP is now available!
In SharePoint, one can use PageViewer WebPart within a webpart page to display another web page within it. All that one is required to do is, provide the URL of the page as the ContentLinkparameter of the WebPart.

However, users might often have requirements of resetting the ContentLink parameter at runtime i.e. they may need to pass a query string parameter dynamically to the referred page. PageViewer does not provide any direct approach to implement this but this doesn't imply that we cannot work around it! We can implement the described functionality by using Reflection.

This hack is illustrated in the example below using C#.NET:

Namespaces which need to be included-

using System.Reflection;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;