<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Rendering an ASP.net UserControl to a String</title>
	<atom:link href="http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/</link>
	<description>I think I can, I know I can</description>
	<lastBuildDate>Sat, 24 Jul 2010 02:35:04 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Jon Kragh</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-60</link>
		<dc:creator>Jon Kragh</dc:creator>
		<pubDate>Sat, 24 Jul 2010 02:35:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-60</guid>
		<description>Javier, very nice!!!</description>
		<content:encoded><![CDATA[<p>Javier, very nice!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javier Callico</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-59</link>
		<dc:creator>Javier Callico</dc:creator>
		<pubDate>Fri, 23 Jul 2010 14:10:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-59</guid>
		<description>You can find the modified version I&#039;m using here:
http://codepaste.net/71sar6</description>
		<content:encoded><![CDATA[<p>You can find the modified version I&#8217;m using here:<br />
<a href="http://codepaste.net/71sar6" rel="nofollow">http://codepaste.net/71sar6</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Kragh</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-58</link>
		<dc:creator>Jon Kragh</dc:creator>
		<pubDate>Fri, 23 Jul 2010 01:18:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-58</guid>
		<description>Hey Javier!

Thanks for the kind words!  And I like your solution, less code!

I&#039;m going to keep your other comment, because I&#039;m not sure if anything was stripped out now that I&#039;m looking at it.  Plus it gives good context to other viewers that we don&#039;t need another delegate.

Good Job!
Jon</description>
		<content:encoded><![CDATA[<p>Hey Javier!</p>
<p>Thanks for the kind words!  And I like your solution, less code!</p>
<p>I&#8217;m going to keep your other comment, because I&#8217;m not sure if anything was stripped out now that I&#8217;m looking at it.  Plus it gives good context to other viewers that we don&#8217;t need another delegate.</p>
<p>Good Job!<br />
Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javier Callico</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-57</link>
		<dc:creator>Javier Callico</dc:creator>
		<pubDate>Mon, 19 Jul 2010 15:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-57</guid>
		<description>Please remove my previous comment since some characters were removed after submitting.

Thanks.</description>
		<content:encoded><![CDATA[<p>Please remove my previous comment since some characters were removed after submitting.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javier Callico</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-56</link>
		<dc:creator>Javier Callico</dc:creator>
		<pubDate>Mon, 19 Jul 2010 15:52:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-56</guid>
		<description>Hi Jon

Very elegant generic wrapper, thanks.

I replaced the InitializeControlDelegate with Action in order to avoid declaring the delegate.

&lt;code&gt;
public static string RenderUserControl(string ControlPath, Action InitControlAction) where T : UserControl
{
    System.Web.UI.Page pageHolder = new Page();
    T ControlToRender = (T)pageHolder.LoadControl(ControlPath);
    pageHolder.Controls.Add(ControlToRender);
    InitControlAction(ControlToRender);
    StringWriter result = new StringWriter();
    System.Web.HttpContext.Current.Server.Execute(pageHolder, result, false);
    return result.ToString();
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hi Jon</p>
<p>Very elegant generic wrapper, thanks.</p>
<p>I replaced the InitializeControlDelegate with Action in order to avoid declaring the delegate.</p>
<p><code><br />
public static string RenderUserControl(string ControlPath, Action InitControlAction) where T : UserControl<br />
{<br />
    System.Web.UI.Page pageHolder = new Page();<br />
    T ControlToRender = (T)pageHolder.LoadControl(ControlPath);<br />
    pageHolder.Controls.Add(ControlToRender);<br />
    InitControlAction(ControlToRender);<br />
    StringWriter result = new StringWriter();<br />
    System.Web.HttpContext.Current.Server.Execute(pageHolder, result, false);<br />
    return result.ToString();<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bharath</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-55</link>
		<dc:creator>Bharath</dc:creator>
		<pubDate>Wed, 14 Apr 2010 16:42:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-55</guid>
		<description>Good one and it help me... thanks for your code snippet.</description>
		<content:encoded><![CDATA[<p>Good one and it help me&#8230; thanks for your code snippet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Kragh</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-53</link>
		<dc:creator>Jon Kragh</dc:creator>
		<pubDate>Thu, 21 Jan 2010 23:11:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-53</guid>
		<description>Hi Thomas!

Thanks for the feedback, it is really cool that you got use out of it.  It makes it worth writing the post!

Jon</description>
		<content:encoded><![CDATA[<p>Hi Thomas!</p>
<p>Thanks for the feedback, it is really cool that you got use out of it.  It makes it worth writing the post!</p>
<p>Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-52</link>
		<dc:creator>Thomas</dc:creator>
		<pubDate>Sun, 17 Jan 2010 09:13:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-52</guid>
		<description>Hey Jon - thanks for this, this adds some really nice features to Scott Gu&#039;s solution. Your solutions here makes this a really extendable control loader - nice work!</description>
		<content:encoded><![CDATA[<p>Hey Jon &#8211; thanks for this, this adds some really nice features to Scott Gu&#8217;s solution. Your solutions here makes this a really extendable control loader &#8211; nice work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Programming news: Alpha Five, IronPython, Scala, F# &#124; Programming and Development &#124; TechRepublic.com</title>
		<link>http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/comment-page-1/#comment-40</link>
		<dc:creator>Programming news: Alpha Five, IronPython, Scala, F# &#124; Programming and Development &#124; TechRepublic.com</dc:creator>
		<pubDate>Mon, 02 Nov 2009 22:39:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.jonkragh.com/index.php/rendering-an-asp-net-usercontrol-to-a-string/#comment-40</guid>
		<description>[...] Jon Kragh has a useful tip that shows you how to render an ASP.NET User Control as a string. This is particularly useful for the ASP.NET MVC folks out there. [...]</description>
		<content:encoded><![CDATA[<p>[...] Jon Kragh has a useful tip that shows you how to render an ASP.NET User Control as a string. This is particularly useful for the ASP.NET MVC folks out there. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
