<?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>DotBert &#187; web user control</title>
	<atom:link href="http://dotbert.loedeman.nl/category/aspnet/web-user-control/feed" rel="self" type="application/rss+xml" />
	<link>http://dotbert.loedeman.nl</link>
	<description>.NET thoughts by Bert Loedeman</description>
	<lastBuildDate>Wed, 19 Oct 2011 07:57:01 +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>How to insert blank rule (&lt;br /&gt;) from C# code</title>
		<link>http://dotbert.loedeman.nl/how-to-insert-blank-rule-from-c-code</link>
		<comments>http://dotbert.loedeman.nl/how-to-insert-blank-rule-from-c-code#comments</comments>
		<pubDate>Thu, 13 Aug 2009 07:37:26 +0000</pubDate>
		<dc:creator>Bert Loedeman</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[web user control]]></category>

		<guid isPermaLink="false">http://dotbert.loedeman.nl/?p=102</guid>
		<description><![CDATA[Once in a while I have to develop custom user controls that require blank rules in them. Almost always I think again: &#8216;I should have blogged about it, would have saved me lots of time searching&#8217; &#8230; Well, no more, because here it is&#8230; Many people using blank rules in C# code, use the following [...]]]></description>
			<content:encoded><![CDATA[<p>Once in a while I have to develop custom user controls that require blank rules in them. Almost always I think again: &#8216;I should have blogged about it, would have saved me lots of time searching&#8217; <img src='http://dotbert.loedeman.nl/wp-includes/images/smilies/icon_smile.gif' alt="How to insert blank rule (&lt;br /&gt;) from C# code icon smile" class='wp-smiley' title="How to insert blank rule (&lt;br /&gt;) from C# code" />  &#8230; Well, no more, because here it is&#8230;</p>
<p>Many people using blank rules in C# code, use the following commands:</p>
<pre class="brush: csharp; title: ; notranslate">
var brControl1 = new HtmlGenericControl { InnerHtml = &quot;&lt;br /&gt;&quot; };
var brControl2 = new HtmlGenericControl(&quot;br&quot;);
</pre>
<p>However, brControl1 also prints a &lt;span&gt; tag and brControl2 prints &lt;br&gt;&lt;/br&gt;. Both options are not really useful. You should take notice of the fact that the HtmlGenericControl is not meant to be used for anything else than span, body, div and font (what is designed for &#8216;as the word goes&#8217;).  The way to go when printing a blank rule is:</p>
<pre class="brush: csharp; title: ; notranslate">
var brControl3 = new LiteralControl(&quot;&lt;br /&gt;&quot;);
</pre>
<p>This actually prints exactly what you would like it to print, namely &lt;br /&gt;. Hope this helps you too <img src='http://dotbert.loedeman.nl/wp-includes/images/smilies/icon_smile.gif' alt="How to insert blank rule (&lt;br /&gt;) from C# code icon smile" class='wp-smiley' title="How to insert blank rule (&lt;br /&gt;) from C# code" />  ! BTW, if you are using the HtmlTextWriter class, you can also use the WriteBreak() function if you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://dotbert.loedeman.nl/how-to-insert-blank-rule-from-c-code/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

