<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rory Hansen - Web and mobile app development, affiliate marketing, making money online, and entrepreneurship &#187; c#</title>
	<atom:link href="http://www.roryhansen.ca/category/web-development/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.roryhansen.ca</link>
	<description>Affiliate marketing, Internet marketing, web development, and small business ideas.</description>
	<lastBuildDate>Wed, 02 Nov 2011 00:49:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using IFRAME in ASP.NET</title>
		<link>http://www.roryhansen.ca/2005/08/22/using-iframes-in-aspnet/</link>
		<comments>http://www.roryhansen.ca/2005/08/22/using-iframes-in-aspnet/#comments</comments>
		<pubDate>Tue, 23 Aug 2005 02:37:54 +0000</pubDate>
		<dc:creator>Rory</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.roryhansen.ca/?p=32</guid>
		<description><![CDATA[So, I&#8217;ve basically finished coding the &#8220;Google Suggest&#8221;-like web user control I was writing for the company I&#8217;m doing a co-op work term at. I&#8217;m now in the process of integrating it into an existing textbox control that they&#8217;ve developed, and that should be finished soon. One part of the web user control is an [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve basically finished coding the &#8220;Google Suggest&#8221;-like web user control I was writing for the company I&#8217;m doing a co-op work term at. I&#8217;m now in the process of integrating it into an existing textbox control that they&#8217;ve developed, and that should be finished soon.</p>
<p>One part of the web user control is an iframe, which is used to counteract the much-documented <a href="http://www.google.ca/search?num=100&amp;hl=en&amp;rls=GGLD%2CGGLD%3A2004-41%2CGGLD%3Aen&amp;q=internet+explorer+z-index+select+box+problem&amp;meta=">z-index and select box problem in Internet Explorer</a>. By placing the iframe directly below the div that the Google Suggest results are displayed in (as in one z-index less than the z-index of the results div), we can avoid this problem all-together.</p>
<p>But, to make the web user control as reusable as possible, I needed to be able to name this iframe uniquely, incase there are multiple instances of the control on the same aspx page. To do this, I needed to be able to specify the name of the iframe when it is rendered (or guarantee that it would be automagically named uniquely), and I figured out I could accomplish this by using two standard controls: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsplaceholderclasstopic.asp">PlaceHolder</a> and <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuihtmlcontrolshtmlgenericcontrolclasstopic.asp">HtmlGenericControl</a>.</p>
<p>First, I create the HtmlGenericControl object that will eventually render as an iframe and specify whatever attributes this iframe will have:</p>
<p><code>// Create new iframe control<br />
HtmlGenericControl searchFrame = new HtmlGenericControl("iframe");<br />
searchFrame.ID = "searchFrame";<br />
searchFrame.Attributes.Add("class", "searchFrame");<br />
searchFrame.Attributes.Add("frameborder", "0");</code></p>
<p>Then, I can add it to the PlaceHolder&#8217;s controls collection:</p>
<p><code>// Add it to the Controls collection of the PlaceHolder control<br />
searchHolder.Controls.Add(searchFrame);</code></p>
<p>Finally, I add the PlaceHolder control into my ascx document where I&#8217;d like the iframe to eventually be:</p>
<p><code>&lt;div class="searchContainer"&gt;<br />
   &lt;asp:PlaceHolder id="searchHolder" runat="server" /&gt;<br />
&lt;/div&gt;</code></p>
<p>Now, an iframe will appear in the outputted HTML code where the placeholder once was. But more than that, since I used an ASP.NET control to actually create the iframe, the iframe will be named uniquely. We even know what it&#8217;ll be called: this.UniqueID + &#8220;_searchFrame&#8221;. This is beneficial to me since I can now reference that iframe by name throughout my JavaScript code and show it or hide it when necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhansen.ca/2005/08/22/using-iframes-in-aspnet/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

