Monday, September 21, 2009

Setting properties for iFrame from code behind

Scenario:
I have an iFrame in the markup. I need to set properties of the iFrame through code

Code:
//Markup

<iframe src ="[Url Here]" runat="server" frameborder=0 id="iFrame">
<p>Your browser does not support iframes.</p>
</iframe>

//Code Behind

protected System.Web.UI.HtmlControls.HtmlGenericControl iFrame;

iFrame.Attributes["src"] = "[The Url]";

No comments:

Post a Comment