Friday, 6 January 2017

SharePoint: How to add iframe in an application page?


Add <WebPartPages:AllowFraming runat="server" /> in the corresponding master page.

SharePoint: How to add iframe in an application page?

Then you can use iframe in the application page:

<iframe id="iframe1" src="https://navneetchanalia.blogspot.in/"></iframe>


To dynamically set the URL from code behind:

Add following on aspx page:

<asp:Literal ID="ltHTML" runat="server"></asp:Literal>

And on code behind:

protected void SetIframe(string url)
        {
            ltHTML.Text = string.Format("<iframe id=\"testFrame\" src=\"{0}\" style=\"width: 800px; height: 700px;\"></iframe>", url);
        }

No comments:

Post a Comment