Archive for May, 2008

How to use an iFrame and set the URL in Server Side C#

May 16, 2008

//Here is the HTML for the IFrame:

<iframe runat=”server” id=”ifStellentViewer” width=”100%” height=”450px”></iframe>

//Here is the server side event code:

if (_iFrameTarget != null)
{
_iFrameTarget.Attributes["src"] = sHTTP_URL; //eg: http://www.yahoo.com
}

//Here is the object defintion in case you need to cast it:

private HtmlGenericControl _iFrameTarget;

public HtmlGenericControl TargetFrame
{
get
{
return _iFrameTarget;
}
set
{
_iFrameTarget = value;
}
}

//Then we just set the iframe as a referece like:

UcStellentTree1.TargetFrame = ifStellentViewer;