Saturday, July 25, 2009

Iframe inside mojoPortal

The first thing that I tried when I needed add an Iframe element embeded in UserControl, was add runat="server" attribute, but it throws an error. After the approach below, it works pefect.


HtmlGenericControl ifr = new HtmlGenericControl("iframe");
ifr.Attributes.Add("id","myiframe");
ifr.Attributes.Add("onload","doSomething();");
ifr.Attributes.Add("height","400");
...
PlaceHolder1.Controls.Add(ifr); //the final trick


I read this articles before:
http://www.justskins.com/forums/c-htmlgenericcontrol-90652.html

Happy coding
Btnz :)

No comments:

Google