how i opening an iframe codebehind record asp.net?


i am perplexing set attributes an iframe html control code-behind aspx.cs file.



i came opposing says findcontrol non-asp controls using:



the aspx record contains:



<iframe id="contentpanel1" runat="server" />


and following code-behind record contains:



protected vacant page_load(object sender, eventargs e)
{
htmlcontrol contentpanel1 = (htmlcontrol)this.findcontrol("contentpanel1");
(contentpanel1 != null)
contentpanel1.attributes["src"] = "http://www.stack .com";

}


except it's awaiting control, contentpanel1 null.






update 1



looking during rendered html:



<iframe id="ctl00_contentplaceholder1_contentpanel1"></iframe>


i attempted changing code-behind to:



htmlcontrol contentpanel1 = (htmlcontrol)this.findcontrol("ctl00_contentplaceholder1_contentpanel1");

if (contentpanel1 != null)
contentpanel1.attributes["src"] = "http://www.clis.com";


but didn't help.



i am controlling masterpage.






update 2



changing aspx record to:



<iframe id="contentpanel1" name="contentpanel1" runat="server" />


also didn't help






answer



the answer obvious, unworthy even seeking uncanny question. have aspx code:



<iframe id="contentpanel1" runat="server" />


and wish opening iframe code-behind file, only opening it:



this.contentpanel1.attributes["src"] = "http://www.stack .com";


Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members