<?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>Jamie Dixon</title>
	<atom:link href="http://www.jamie-dixon.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamie-dixon.co.uk</link>
	<description>Web Developer, Software Engineer and Mixed Language Artist</description>
	<lastBuildDate>Thu, 18 Aug 2011 09:31:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Selenium IDE for Firefox 6</title>
		<link>http://www.jamie-dixon.co.uk/daily-blog/selenium-ide-for-firefox-6/</link>
		<comments>http://www.jamie-dixon.co.uk/daily-blog/selenium-ide-for-firefox-6/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 09:28:22 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Daily Blog]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=292</guid>
		<description><![CDATA[Whilst not yet in public release, a new version of the Selenium IDE is now available for those using Firefox 6.
http://xserve.openqa.org:8085/browse/IDE-EDITOR-MULTI-166/artifact
]]></description>
			<content:encoded><![CDATA[<p>Whilst not yet in public release, a new version of the Selenium IDE is now available for those using Firefox 6.</p>
<p><a href="http://xserve.openqa.org:8085/browse/IDE-EDITOR-MULTI-166/artifact">http://xserve.openqa.org:8085/browse/IDE-EDITOR-MULTI-166/artifact</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/daily-blog/selenium-ide-for-firefox-6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Replacing Request.IsAjaxRequest() with ActionFilter</title>
		<link>http://www.jamie-dixon.co.uk/mvc/replacing-request-isajaxrequest-with-actionfilter/</link>
		<comments>http://www.jamie-dixon.co.uk/mvc/replacing-request-isajaxrequest-with-actionfilter/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 16:34:51 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=286</guid>
		<description><![CDATA[Ever wondered if you can replace all those

?View Code CSHARPif&#40;Request.IsAjaxRequest&#40;&#41;&#41;
&#123;
// return some partial view
&#125;

with an action filter?
Although it&#8217;s not much code to write the above in many controller methods, I was intrigued to figure out how this behaviour could be replaced through the use of a custom ActionFilter. Here&#8217;s what I came up with (It [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wondered if you can replace all those</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p286code4'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2864"><td class="code" id="p286code4"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>Request<span style="color: #008000;">.</span><span style="color: #0000FF;">IsAjaxRequest</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008080; font-style: italic;">// return some partial view</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>with an action filter?</p>
<p>Although it&#8217;s not much code to write the above in many controller methods, I was intrigued to figure out how this behaviour could be replaced through the use of a custom ActionFilter. Here&#8217;s what I came up with (It might not be any better than using the above and this was created purely out of a desire to figure out how possible it could be):</p>
<p><strong>Action Filter:</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p286code5'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2865"><td class="code" id="p286code5"><pre class="csharp" style="font-family:monospace;"> <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> ReturnPartialForAjaxRequestActionFilter <span style="color: #008000;">:</span> ActionFilterAttribute
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> ViewName <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnActionExecuted<span style="color: #008000;">&#40;</span>ActionExecutedContext filterContext<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>ViewName <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                var request <span style="color: #008000;">=</span> filterContext<span style="color: #008000;">.</span><span style="color: #0000FF;">RequestContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">HttpContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Request</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>request<span style="color: #008000;">.</span><span style="color: #0000FF;">IsAjaxRequest</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    var result <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>ViewResult<span style="color: #008000;">&#41;</span>filterContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Result</span><span style="color: #008000;">;</span>
&nbsp;
                    filterContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Result</span> <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> PartialViewResult
                    <span style="color: #008000;">&#123;</span>
                        ViewName <span style="color: #008000;">=</span> ViewName,
                        ViewData <span style="color: #008000;">=</span> result<span style="color: #008000;">.</span><span style="color: #0000FF;">ViewData</span>
                    <span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
            <span style="color: #0600FF; font-weight: bold;">base</span><span style="color: #008000;">.</span><span style="color: #0000FF;">OnActionExecuted</span><span style="color: #008000;">&#40;</span>filterContext<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Usage:</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p286code6'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2866"><td class="code" id="p286code6"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>ReturnPartialForAjaxRequestActionFilter<span style="color: #008000;">&#40;</span>ViewName <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;PartialViewName&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> ActionResult MyActionResult<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>This is possibly a bit overkill given that it most likely involves more typing than simply writing out the original if statement however as a thought exercise it was quite fun to implement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/mvc/replacing-request-isajaxrequest-with-actionfilter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASOS Marketplace  &#8211; It&#8217;s alive!</title>
		<link>http://www.jamie-dixon.co.uk/asos/asos-marketplace-its-alive/</link>
		<comments>http://www.jamie-dixon.co.uk/asos/asos-marketplace-its-alive/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 13:51:16 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[ASOS]]></category>
		<category><![CDATA[ASOSMarketplace]]></category>
		<category><![CDATA[Awesome]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=279</guid>
		<description><![CDATA[After months of hardwork from everyone on the team, today is the day that ASOS Marketplace goes live (https://marketplace.asos.com) !
There&#8217;s a lot I want to say about this project and the people who&#8217;ve been involved but that&#8217;s going to have to wait until after today. As with any major project like this, launch day is [...]]]></description>
			<content:encoded><![CDATA[<p>After months of hardwork from everyone on the team, today is the day that <a href="https://marketplace.asos.com">ASOS Marketplace</a> goes live (<a href="https://marketplace.asos.com">https://marketplace.asos.com</a>) !</p>
<p>There&#8217;s a lot I want to say about this project and the people who&#8217;ve been involved but that&#8217;s going to have to wait until after today. As with any major project like this, launch day is a big deal.</p>
<p>ASOS Marketplace is by far the largest and most fun project I&#8217;ve worked on to date and seeing it go live today is a really special moment.</p>
<p>I&#8217;m writing this post just moments before we hit the go live button knowing that as soon as we go live it&#8217;s going to be all hands on deck.</p>
<p>If you&#8217;re reading this post then everything has gone well and I&#8217;m likely dancing around the office with the rest of the team.</p>
<p><a href="https://marketplace.asos.com">ASOS Marketplace</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/asos/asos-marketplace-its-alive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get random item from IList&lt; T &gt;</title>
		<link>http://www.jamie-dixon.co.uk/uncategorized/get-random-item-from-ilist-t/</link>
		<comments>http://www.jamie-dixon.co.uk/uncategorized/get-random-item-from-ilist-t/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 10:39:38 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=273</guid>
		<description><![CDATA[In what could turn out to be a series of posts about helpful extension methods I thought I&#8217;d include this quick little method for getting a random item from an IList collection.

?View Code CSHARPpublic static T GetRandomItem&#60;T&#62;&#40;this IList&#60;T&#62; collection&#41;
        &#123;
         [...]]]></description>
			<content:encoded><![CDATA[<p>In what could turn out to be a series of posts about helpful extension methods I thought I&#8217;d include this quick little method for getting a random item from an IList<T> collection.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p273code9'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2739"><td class="code" id="p273code9"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> T GetRandomItem<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> IList<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> collection<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> collection<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Random<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Next</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span>, collection<span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>This can then be used as follows:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p273code10'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p27310"><td class="code" id="p273code10"><pre class="csharp" style="font-family:monospace;">var collectionList <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> List<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&gt;</span> <span style="color: #008000;">&#123;</span><span style="color: #666666;">&quot;String 1&quot;</span>, <span style="color: #666666;">&quot;String 2&quot;</span>, <span style="color: #666666;">&quot;String 3&quot;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
<span style="color: #6666cc; font-weight: bold;">string</span> item <span style="color: #008000;">=</span> collectionList<span style="color: #008000;">.</span><span style="color: #0000FF;">GetRandomItem</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/uncategorized/get-random-item-from-ilist-t/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ContainsAny &amp; EquelsAny</title>
		<link>http://www.jamie-dixon.co.uk/uncategorized/containsany-equelsany/</link>
		<comments>http://www.jamie-dixon.co.uk/uncategorized/containsany-equelsany/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 11:19:07 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=268</guid>
		<description><![CDATA[This post is a bit of a reference for myself and also a handy tip for those wondering how to perform Contains and Equels on a collection of strings.
For the purposes I needed I simply wanted to check if a string Equels Any or Contains Any of an array of strings. I put these together [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a bit of a reference for myself and also a handy tip for those wondering how to perform Contains and Equels on a collection of strings.</p>
<p>For the purposes I needed I simply wanted to check if a string Equels Any or Contains Any of an array of strings. I put these together as a couple of extension methods:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p268code14'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p26814"><td class="code" id="p268code14"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">bool</span> ContainsAny<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">string</span> input, <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> items<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> items<span style="color: #008000;">.</span><span style="color: #0000FF;">Any</span><span style="color: #008000;">&#40;</span>input<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p268code15'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p26815"><td class="code" id="p268code15"><pre class="csharp" style="font-family:monospace;">        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">bool</span> EqualsAny<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">string</span> input, <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> items<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> items<span style="color: #008000;">.</span><span style="color: #0000FF;">Any</span><span style="color: #008000;">&#40;</span>input<span style="color: #008000;">.</span><span style="color: #0000FF;">Equels</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>That&#8217;s all that&#8217;s required.</p>
<p>This means we can  now do things like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p268code16'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p26816"><td class="code" id="p268code16"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">bool</span> isWomenOrUnisex <span style="color: #008000;">=</span> category<span style="color: #008000;">.</span><span style="color: #0000FF;">EquelsAny</span><span style="color: #008000;">&#40;</span><a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#123;</span><span style="color: #666666;">&quot;women&quot;</span>,<span style="color: #666666;">&quot;unisex&quot;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Simples!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/uncategorized/containsany-equelsany/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing Parameters to an ActionFilter in ASP.NET MVC</title>
		<link>http://www.jamie-dixon.co.uk/uncategorized/passing-parameters-to-an-actionfilter-in-asp-net-mvc/</link>
		<comments>http://www.jamie-dixon.co.uk/uncategorized/passing-parameters-to-an-actionfilter-in-asp-net-mvc/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 11:04:41 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=254</guid>
		<description><![CDATA[Creating action filters is quite a simple process. You can simply inherit from ActionFilterAttribute and bingo, you&#8217;ve got yourself a custom ActionFilter.
There&#8217;s a lot of articles out in the wilderness of the web that explain how to go about creating custom ActionFilters and most of them are pretty good articles.
The one thing I&#8217;ve not been [...]]]></description>
			<content:encoded><![CDATA[<p>Creating action filters is quite a simple process. You can simply inherit from ActionFilterAttribute and bingo, you&#8217;ve got yourself a custom ActionFilter.</p>
<p>There&#8217;s a lot of articles out in the wilderness of the web that explain how to go about creating custom ActionFilters and most of them are pretty good articles.</p>
<p>The one thing I&#8217;ve not been able to find online is some instruction of how to create action filters that accept some kind of parameters. We already see this concept being used by such things as the OutputCacheAttribute action method where we can pass in a Duration, and various other parameters:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p254code20'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25420"><td class="code" id="p254code20"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>OutputCache<span style="color: #008000;">&#40;</span>Duration <span style="color: #008000;">=</span> <span style="color: #FF0000;">5</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span></pre></td></tr></table></div>

<p>So how do we allow our own custom action filters to accept parameters in this same way?</p>
<p>The answer seems really simple once you know however a search on Google doesn&#8217;t seem to return much in the way of any answers to this question (as with many of my posts, they&#8217;re usually things that I haven&#8217;t been able to find online already).</p>
<p>The simple answer is that: <strong>Action filter parameters are properties of the action filter.</strong></p>
<p>Here&#8217;s a short example custom action filter that exposes a property which I then use when attaching the attribute to a class.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p254code21'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25421"><td class="code" id="p254code21"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> CustomActionAttrbitue <span style="color: #008000;">:</span> ActionFilterAttribute
<span style="color: #008000;">&#123;</span>
     <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">int</span> Id <span style="color: #008000;">&#123;</span>get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span><span style="color: #008000;">&#125;</span>
     <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> OnActionExecuting<span style="color: #008000;">&#40;</span>ActionExecutingContext filterContext<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// Do some work here.</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>and in attaching this attribute to a class:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p254code22'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p25422"><td class="code" id="p254code22"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>CustomAction<span style="color: #008000;">&#40;</span>Id <span style="color: #008000;">=</span> <span style="color: #FF0000;">5</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> MyController  <span style="color: #008000;">:</span> Controller
<span style="color: #008000;">&#123;</span>
&nbsp;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Like I said above, once you know that the parameter is a property of the action filter, it seems obvious. Hope this helps someone else looking for this information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/uncategorized/passing-parameters-to-an-actionfilter-in-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rendering a partial view n number of times with ASP.NET MVC</title>
		<link>http://www.jamie-dixon.co.uk/mvc/rendering-a-partial-view-n-number-of-times-with-asp-net-mvc/</link>
		<comments>http://www.jamie-dixon.co.uk/mvc/rendering-a-partial-view-n-number-of-times-with-asp-net-mvc/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 09:31:15 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[MVC]]></category>
		<category><![CDATA[asp.net-mvc2]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[PartialViews]]></category>
		<category><![CDATA[RenderPartial]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=232</guid>
		<description><![CDATA[UPDATE
After spending a little more time working with MVC2 and having read this comment by Brad Wilson, I now know about the existence of Html.Partial which renders a partia view directly to a string.
This simplifies my code in a number of ways. Firstly the code itself is just simpler. There&#8217;s no longer any need to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE</strong></p>
<p>After spending a little more time working with MVC2 and having read <a href="http://stackoverflow.com/questions/1283079/how-does-the-html-helper-renderpartial-work-how-can-i-implement-a-helper-that#answer-1283690">this comment</a> by Brad Wilson, I now know about the existence of Html.Partial which renders a partia view directly to a string.</p>
<p>This simplifies my code in a number of ways. Firstly the code itself is just simpler. There&#8217;s no longer any need to render the partial out to a string because our new Partial method does this for us.</p>
<p>The RenderPartials method now looks like:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p232code28'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23228"><td class="code" id="p232code28"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> RenderPartials<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> HtmlHelper helper, <span style="color: #6666cc; font-weight: bold;">string</span> partialViewName, IEnumerable models, <span style="color: #6666cc; font-weight: bold;">string</span> htmlFormat<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var view <span style="color: #0600FF; font-weight: bold;">in</span> models<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Select</span><span style="color: #008000;">&#40;</span>model <span style="color: #008000;">=&amp;</span>gt<span style="color: #008000;">;</span> helper<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Partial</span><span style="color: #008000;">&#40;</span>partialViewName,model<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                helper<span style="color: #008000;">.</span><span style="color: #0000FF;">ViewContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">HttpContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Response</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Output</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>htmlFormat, view<span style="color: #008000;">.</span><span style="color: #0000FF;">ToHtmlString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>Much cleaner !!</p>
<p>This also fixed up the problem of using a names partial view rather than the full path. Again, all of this is handled by our new Partial method which leaves us get on with the important stuff.</p>
<p>Thanks again to the MVC team for including something extremely useful in MVC2.</p>
<p><strong>Origional Post</strong></p>
<p>I&#8217;ve recently been thinking about the way that RenderPartial works in ASP.NET MVC and one of the things I&#8217;ve been wanting is a way to render a partial view n number of times based on some kind of collection.</p>
<p>I had a look around and didn&#8217;t find anything so I&#8217;ve  written out a solution which I&#8217;d like to share. It&#8217;s by no means a perfect solution right now. I&#8217;d like to add support for named partials rather than specifying the path to the partial view and this will be part of the next iteration.</p>
<p><strong>Why?</strong><br />
The main reason for this solution is to solve the problem of having looping code in the views. This can quite often get a bit messy especially when mixing html and C#.</p>
<p><strong>The implementation</strong></p>
<p>Firstly, here&#8217;s the method signature:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p232code29'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23229"><td class="code" id="p232code29"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> RenderPartials<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> HtmlHelper helper,
                                                 <span style="color: #6666cc; font-weight: bold;">string</span> partialViewName,
                                                 IEnumerable models,
                                                 <span style="color: #6666cc; font-weight: bold;">string</span> htmlFormat<span style="color: #008000;">&#41;</span></pre></td></tr></table></div>

<ul>
<li>The partialViewName parameter is going to be the location of our partial view. I&#8217;m going to be improving this to accept just the name of the view in this next iteration.</li>
<li>The models parameter contains a collection and for each item in that collection, we&#8217;ll render out our partial view.</li>
<li>The htmlFormat paramter is an optional parameter. This basically allows you to specify code that you&#8217;d like to be part of the iteration of each model item with {0} being the partial view itself (I&#8217;ll give an example below)</li>
</ul>
<p><strong>The method:</strong></p>
<p>So here&#8217;s the method as it stands at the moment.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p232code30'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23230"><td class="code" id="p232code30"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> RenderPartials<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> HtmlHelper helper, <span style="color: #6666cc; font-weight: bold;">string</span> partialViewName, IEnumerable models, <span style="color: #6666cc; font-weight: bold;">string</span> htmlFormat<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            htmlFormat <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>htmlFormat<span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrEmpty</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span> <span style="color: #666666;">&quot;{0}&quot;</span> <span style="color: #008000;">:</span> htmlFormat<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>var model <span style="color: #0600FF; font-weight: bold;">in</span> models<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                var viewDataDictionary <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ViewDataDictionary<span style="color: #008000;">&#40;</span>model<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                var urlHelper <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> UrlHelper<span style="color: #008000;">&#40;</span>helper<span style="color: #008000;">.</span><span style="color: #0000FF;">ViewContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">RequestContext</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                var x <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> ViewPage <span style="color: #008000;">&#123;</span>ViewData <span style="color: #008000;">=</span> viewDataDictionary, Url <span style="color: #008000;">=</span> urlHelper, ViewContext <span style="color: #008000;">=</span> helper<span style="color: #008000;">.</span><span style="color: #0000FF;">ViewContext</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">;</span>
&nbsp;
                Control control <span style="color: #008000;">=</span> x<span style="color: #008000;">.</span><span style="color: #0000FF;">LoadControl</span><span style="color: #008000;">&#40;</span>partialViewName<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                x<span style="color: #008000;">.</span><span style="color: #0000FF;">Controls</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>control<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                var sb <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StringBuilder<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var sw <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> StringWriter<span style="color: #008000;">&#40;</span>sb<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var tw <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> HtmlTextWriter<span style="color: #008000;">&#40;</span>sw<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#123;</span>
                        x<span style="color: #008000;">.</span><span style="color: #0000FF;">RenderControl</span><span style="color: #008000;">&#40;</span>tw<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        helper<span style="color: #008000;">.</span><span style="color: #0000FF;">ViewContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">HttpContext</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Response</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Output</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Write</span><span style="color: #008000;">&#40;</span>htmlFormat,sb<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">// Output content to the response stream</span>
                    <span style="color: #008000;">&#125;</span>
                <span style="color: #008000;">&#125;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>with a simple overload method to make the htmlFormat parameter optional:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p232code31'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23231"><td class="code" id="p232code31"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> RenderPartials<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> HtmlHelper helper, <span style="color: #6666cc; font-weight: bold;">string</span> partialViewName, IEnumerable models<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            helper<span style="color: #008000;">.</span><span style="color: #0000FF;">RenderPartials</span><span style="color: #008000;">&#40;</span>partialViewName,models,<span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p><strong>How do we use it?</strong></p>
<p>Here&#8217;s a basic example of how we can use this new RenderPartials method within one of our views:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p232code32'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23232"><td class="code" id="p232code32"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&amp;</span>lt<span style="color: #008000;">;%:</span> Html<span style="color: #008000;">.</span><span style="color: #0000FF;">RenderPartials</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;~/Areas/OrderManagement/Views/Shared/Order.ascx&quot;</span>,
                                   Model<span style="color: #008000;">.</span><span style="color: #0000FF;">Orders</span>,
                                   <span style="color: #666666;">&quot;&lt;span class=&quot;</span>\<span style="color: #008000;">&amp;</span>quot<span style="color: #008000;">;</span>specialOrder\<span style="color: #008000;">&amp;</span>quot<span style="color: #008000;">;</span><span style="color: #666666;">&quot;&gt;{0}&lt;/span&gt;&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008000;">%&amp;</span>gt<span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>This will now render our partial view Order.ascx once for each order in Model.Orders. Our third parameter for htmlFormat specifies some html that we&#8217;re wrapping our partial view in with {0} being the partial view itself. This allows for our front end team to add custom html to specific renderings of our partial view.</p>
<p><strong>Conclusion</strong><br />
So the main idea of this method is to neaten up our views a little bit whilst at the same time, giving our front end guys enough control and flexibility to make the solution viable.</p>
<p>If you have any comments or sugestions you can either drop me a line at jamie@jamie-dixon.co.uk or leave a comment below.</p>
<p><strong>You can follow me on Twitter at <a href="http://twitter.com/jamiedixon">http://twitter.com/jamiedixon</a> <img src='http://www.jamie-dixon.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/mvc/rendering-a-partial-view-n-number-of-times-with-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio &#8211; Lost nesting of codebehind</title>
		<link>http://www.jamie-dixon.co.uk/visual-studio/visual-studio-lost-nesting-of-codebehind/</link>
		<comments>http://www.jamie-dixon.co.uk/visual-studio/visual-studio-lost-nesting-of-codebehind/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 15:13:47 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[csproj]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=219</guid>
		<description><![CDATA[We&#8217;ve all had times when we&#8217;ve created an ASP.NET webpage and then a new page is required with almost identical functionality.
I had that task today and so making things simple I copied the current files, pasted them and made the necessary changes to hook the designer and code-behind files to the aspx page.
This works perfectly. [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve all had times when we&#8217;ve created an ASP.NET webpage and then a new page is required with almost identical functionality.</p>
<p>I had that task today and so making things simple I copied the current files, pasted them and made the necessary changes to hook the designer and code-behind files to the aspx page.</p>
<p>This works perfectly. The code builds, the page runs, everything happens as I expected it to.</p>
<p>Then I noticed a little quirk in Visual Studio 2008. One of the great features of Visual Studio is the way in which it visually nests code-behind files in the Solution Explorer under your aspx file.</p>
<p>After making a copy of my origional page I noticed that my code-behind was left astray. I checked all the references to make sure everything was hooked up correctly but still, my code-behind wasn&#8217;t nesting nicely under my aspx page as usual.</p>
<p>Now I&#8217;m sure many people have come across this problem before however this was a first for me.</p>
<p>It turns out that the references are stores in the csproj file. There is a reference to the code-behind file and a list of dependancies. By default, when doing a copy/paste of files outside of Visual Studio, this reference is not updated and the code-behind file doesn&#8217;t attach itself to the aspx file in the Solution Explorer.</p>
<p>The solution is to simply add a reference to the dependant aspx fie in the csproj file like so:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p219code34'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21934"><td class="code" id="p219code34"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Compile</span> <span style="color: #000066;">Include</span>=<span style="color: #ff0000;">&quot;myShinyNewFile.aspx.cs&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;DependentUpon<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>myShinyNewFile.aspx<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/DependentUpon<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SubType<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ASPXCodeBehind<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/SubType<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Compile<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Once you&#8217;ve added the second line into the csproj file, restarting visual studio brings back the much loved nesting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/visual-studio/visual-studio-lost-nesting-of-codebehind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading EPiServer to version 6</title>
		<link>http://www.jamie-dixon.co.uk/episerver/upgrading-episerver-to-version-6/</link>
		<comments>http://www.jamie-dixon.co.uk/episerver/upgrading-episerver-to-version-6/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 13:56:22 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[EPiServer]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=214</guid>
		<description><![CDATA[With the new EPiServer 6 now available to the masses, upgrading current EPiServer sites is something we&#8217;ve all been looking forward to.
I was tasked this week with upgrading a pretty large website we&#8217;ve current got in EPiServer 5.2.375.236.
There&#8217;s a nice little upgrade utility that comes with the EPiServer Deployment Center and this was my first [...]]]></description>
			<content:encoded><![CDATA[<p>With the new EPiServer 6 now available to the masses, upgrading current EPiServer sites is something we&#8217;ve all been looking forward to.</p>
<p>I was tasked this week with upgrading a pretty large website we&#8217;ve current got in EPiServer 5.2.375.236.</p>
<p>There&#8217;s a nice little upgrade utility that comes with the EPiServer Deployment Center and this was my first port of call. I knew there&#8217;d be more to it than simply using the upgrade wizard however this handy utility did the majority of the work.</p>
<p>I then headed over to the EPiServer CMS folder on my local machine to grab the required DLLs from the &#8220;6.0.530.0&#8243; folder, dropped these into my websites DLL folder and updated all my references in Visual Studio. Bingo! Right? Well almost.</p>
<p>After running the project for the first time I came across the following error message:</p>
<blockquote><p>Cannot resolve dependencies for the following module(s)<br />
EPiServer.Cms.Shell.UI.InitializableModule<br />
EPiServer.Cms.Shell.UI.InitializableModule<br />
EPiServer.Web.InitializationModule<br />
EPiServer.Web.InitializationModule</p></blockquote>
<p>The error is quite clear and I knew that some dependancies were missing, I just didn&#8217;t know which ones.</p>
<p>After some digging around and much testing, it turns out that not all of the required DLLs are present in the &#8220;6.0.530.0&#8243; folder (C:\Program Files\EPiServer\CMS\6.0.530.0 &#8211; on my machine).</p>
<p>Doing a quick *.dll search in the CMS folder I found a zip file containing a full EPiServer project with a complete bin folder (C:\Program Files\EPiServer\CMS\6.0.530.0\VSTemplates\EPiServerProject.zip &#8211; on my machine).</p>
<p>This bin folder contains 35 dlls where as the &#8220;6.0.530.0/bin&#8221; folder only contains 26 dlls.</p>
<p>Copying all of these new dlls to my DLLs folder, updating my references in Visual Studio once more and running the project now works as expected <img src='http://www.jamie-dixon.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>EPiServer 6 is looking really slick and the admin panel has improved hugely.</p>
<p>I&#8217;m hoping that this post will be of help to all EPiServer developers finding they have the same problem. Having searched Google for a good couple of hours yielding no helpful results on this one, I hope this post will be of much help.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/episerver/upgrading-episerver-to-version-6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Global Resource strings by property</title>
		<link>http://www.jamie-dixon.co.uk/concepts/global-resource-strings-by-property/</link>
		<comments>http://www.jamie-dixon.co.uk/concepts/global-resource-strings-by-property/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 15:10:44 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[concepts]]></category>
		<category><![CDATA[App_GlobalResources]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[resources]]></category>

		<guid isPermaLink="false">http://www.jamie-dixon.co.uk/?p=208</guid>
		<description><![CDATA[Every now and then I come across a bunch of string literals littered through out some code and begin the task of moving them out into their own resource file (.resx).
Gaining access to these strings from C# is pretty easy however I&#8217;m yet to find anywhere explaining it the way I find simplest.
Assuming your resx [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I come across a bunch of string literals littered through out some code and begin the task of moving them out into their own resource file (.resx).</p>
<p>Gaining access to these strings from C# is pretty easy however I&#8217;m yet to find anywhere explaining it the way I find simplest.</p>
<p>Assuming your resx file is stored in the App_GlobalResources folder, you can basically assign your resource file to a variable in your C# using the following syntax:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p208code37'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p20837"><td class="code" id="p208code37"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Res </span><span style="color: #008000;">=</span> Resources<span style="color: #008000;">.</span><span style="color: #0000FF;">MyResourceFile</span></pre></td></tr></table></div>

<p>This then gives you the ability to referene the contents of the resource file as properties in your code.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p208code38'); return false;">View Code</a> CSHARP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p20838"><td class="code" id="p208code38"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">string</span> x <span style="color: #008000;">=</span> Res<span style="color: #008000;">.</span><span style="color: #0000FF;">OneOfMyStringNames</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.jamie-dixon.co.uk/concepts/global-resource-strings-by-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

