How can I access an IFRAME from the codebehind file in ASP.NET?
If the iframe is directly on the page where the code is running, you should be able to reference it directly:
contentPanel1.Attribute = value;
If not (it's in a child control, or the MasterPage), you'll need a good idea of the hierarchy of the page... Or use the brute-force method of writing a recursive version of FindControl().
Where is your iframe embedded?
Having this code
<body><iframe id="iFrame1" runat="server"></iframe><form id="form1" runat="server"><div> <iframe id="iFrame2" runat="server"></iframe></div></form>
I can access with iFrame1.Attributes["src"]
just to iFrame1 and not to iFrame2.
Alternatively, you can access to any element in your form with:
FindControl("iFrame2") as System.Web.UI.HtmlControls.HtmlGenericControl