IFRAME - loading pages dynamically
I wanted to load pages dynamically into an IFRAME, but then I realised that you can't access the src attribute from code-behind, not even if you add runat=server... Here is the solution:
1. Add runat=server to the IFRAME.
2. In the declarations section declare a HtmlGenericControl
protected System.Web.UI.HtmlControls.HtmlGenericControl frame1;
3. Find your IFRAME :)
HtmlControl frame1 = (HtmlControl)this.FindControl("frame1");
4. Lastly, to access your IFRAME's src attribute:
frame1.Attributes["src"] = "http://www.google.com";
Thanks Harish!!!