Render Iframes dynamically inside SharePoint Application Pages

There is a requirement to render the publically available web site content inside SharePoint application pages, dynamically based on arbitrary condition. This can be done in two ways. The first option is to use the page viewer web part and dynamically set the url of page viewer using a user control tied to the master page. The second option is to design an application page and render the external content using IFrames. The option of application pages + Iframes is better compared to dynamic page viewer web part way, considering many pros and cons.

The best way to achieve this to have an ASP.NETuser control that hosts the IFrame. Then host the entire user control inside the application page. Because user control gives the more control and flexibility to manipulate the properties of Iframes at run-time, than finding the logical event of ASP.NET page life-cycle and accomplish this task.

.  On the page load of user control, add the src property of the user control

 protected void Page_Load(object sender, EventArgs e)
        {
            this.IFrame1.Attributes.Add("src", ThirdPartyUrl);
        }

 Subscribe to my post

One thought on “Render Iframes dynamically inside SharePoint Application Pages

  1. Pingback: Render Iframes dynamically inside SharePoint Application Pages - My experiments with SharePoint, Azure and .NET using Visual Studio

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.