<?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>Martijn Boland &#187; ASP.NET MVC</title>
	<atom:link href="http://blogs.taiga.nl/martijn/category/aspnet-mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.taiga.nl/martijn</link>
	<description>New adventures in .NET</description>
	<lastBuildDate>Tue, 27 Apr 2010 20:51:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Paging demo for ASP.NET MVC 2</title>
		<link>http://blogs.taiga.nl/martijn/2010/01/27/paging-demo-for-asp-net-mvc-2/</link>
		<comments>http://blogs.taiga.nl/martijn/2010/01/27/paging-demo-for-asp-net-mvc-2/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 18:27:58 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Area]]></category>
		<category><![CDATA[Paging]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/2010/01/27/paging-demo-for-asp-net-mvc-2/</guid>
		<description><![CDATA[During work, I discovered that the pager that I created a while ago didn’t work properly when using ASP.NET MVC2 area’s. The links that were generated didn’t count for the current area that the controller and views were in, resulting in wrong urls. Luckily the ASP.NET MVC team also ran into this issue and created [...]]]></description>
			<content:encoded><![CDATA[<p>During work, I discovered that the <a href="http://blogs.taiga.nl/martijn/2008/08/27/paging-with-aspnet-mvc/" target="_blank">pager that I created a while ago</a> didn’t work properly when using ASP.NET MVC2 area’s. The links that were generated didn’t count for the current area that the controller and views were in, resulting in wrong urls. Luckily the ASP.NET MVC team also ran into this issue and created an GetVirtualPathForArea() extension method on RouteCollection. Calling this one, instead of GetVirtualPath() made things work properly in area’s.</p>
<p>You can get the code for ASP.NET MVC 2 at <a title="http://github.com/martijnboland/MvcPaging/tree/mvc2" href="http://github.com/martijnboland/MvcPaging/tree/mvc2">http://github.com/martijnboland/MvcPaging/tree/mvc2</a> (mvc2 branch of the MvcPaging repository).</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2010/01/27/paging-demo-for-asp-net-mvc-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Considering ASP.NET MVC UI controls? Learn HTML and Javascript!</title>
		<link>http://blogs.taiga.nl/martijn/2009/08/13/considering-asp-net-mvc-ui-controls-learn-html-and-javascript/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/08/13/considering-asp-net-mvc-ui-controls-learn-html-and-javascript/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 09:31:16 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[WebForms]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/2009/08/13/considering-asp-net-mvc-ui-controls-learn-html-and-javascript/</guid>
		<description><![CDATA[Warning: highly subjective content ahead. In the recent weeks we’ve seen several control vendors come up with toolkits that target ASP.NET MVC. Personally, I don’t see anything that might make me starting to consider picking one of these toolkits to speed up development. Why on earth would I prefer a wrapper around jQuery UI or [...]]]></description>
			<content:encoded><![CDATA[<p>Warning: highly subjective content ahead.</p>
<p>In the recent weeks we’ve seen <a href="http://www.telerik.com/products/aspnet-mvc.aspx" target="_blank">several</a> <a href="http://mvc.devexpress.com/" target="_blank">control</a> <a href="http://www.syncfusion.com/products/aspnet-mvc" target="_blank">vendors</a> come up with toolkits that target ASP.NET MVC. Personally, I don’t see anything that might make me starting to consider picking one of these toolkits to speed up development. Why on earth would I prefer a wrapper around jQuery UI or shoehorning existing WebForms controls in MVC views?</p>
<p>The beauty of ASP.NET MVC is that it embraces the web as it is and this automatically involves HTML, CSS and Javascript. Don’t be afraid for that. The combination can be so powerful! Why aren’t there any large component vendors for PHP, Rails, Django etc? Isn’t it probably possible that these components are not required to do proper web development?</p>
<p>The control vendors seem to be targeting people who come from a Windows background that don’t want to learn HTML and Javascript, but from my experiences I can say that those people should really stick to WebForms.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/08/13/considering-asp-net-mvc-ui-controls-learn-html-and-javascript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ASP.NET WebForms and MVC together in one project</title>
		<link>http://blogs.taiga.nl/martijn/2009/06/03/aspnet-webforms-and-mvc-together-in-one-project/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/06/03/aspnet-webforms-and-mvc-together-in-one-project/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 21:40:54 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Area]]></category>
		<category><![CDATA[Sample]]></category>
		<category><![CDATA[WebForms]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/2009/06/03/aspnet-webforms-and-mvc-together-in-one-project/</guid>
		<description><![CDATA[This post briefly describes a solution to mix ASP.NET WebForms and MVC in one project. You can download a sample project that might be more useful than my ramblings. Download the sample here, unzip, open with VS 2008 SP1 and hit F5. There are lots of ‘legacy’ ASP.NET WebForms applications out there in the wild. [...]]]></description>
			<content:encoded><![CDATA[<p><em>This post briefly describes a solution to mix ASP.NET WebForms and MVC in one project. You can download a sample project that might be more useful than my ramblings. <a href="http://blogs.taiga.nl/martijn/wp-content/uploads/WebFormsMVCDemo.zip" target="_blank">Download the sample here</a>, unzip, open with VS 2008 SP1 and hit F5.</em></p>
<p>There are lots of ‘legacy’ ASP.NET WebForms applications out there in the wild. What if you want to create new functionality or rebuild an existing part with ASP.NET MVC, but you can’t (or won’t) create a separate new project?</p>
<p>The simple solution is to add the default MVC folders (Content, Controlllers, Scripts, Views etc.) to the root of the web project, add references to the MVC binaries, modify web.config and add the MVC GUID to the ProjectTypeGuids in the project file. A major drawback however is that it pollutes the root of your carefully structured application. This post will show you how you can logically separate the new MVC pieces from the existing WebForms app in a single project.</p>
<h3>Isolate the MVC bits</h3>
<p><img title="webforms-mvc-solution" style="border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px" height="449" alt="webforms-mvc-solution" src="http://blogs.taiga.nl/martijn/wp-content/uploads/2009/06/webformsmvcsolution3.png" width="297" align="right" border="0" />&#160; A simple requirement: I want that all my MVC folders reside in the folder /MyMvcApp <em>and </em>I also want that all urls of the MVC app start with /mymvcapp. No interference with my old WebForms app please.</p>
<h3></h3>
<h3>Area’s</h3>
<p>About a year ago, <a href="http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx">Phil Haacked showed a concept called area’s</a> to partition an ASP.NET MVC application. After that, <a href="http://blog.codeville.net/2008/11/05/app-areas-in-aspnet-mvc-take-2/">Steve Sanderson came up with an improved version</a> of the concept.</p>
<p>Although designed to partition an MVC application, area’s are also useful when we want to isolate our MVC application from our existing WebForms app. <a href="http://blog.codeville.net/2008/11/05/app-areas-in-aspnet-mvc-take-2/" target="_blank">The solution from Steve Sanderson</a> almost completely fits our needs, follow the link for more technical details. The only thing I removed was the usage of an Areas subfolder in the project where all the individual MVC sub-applications. Simply didn’t need the extra subfolder and url of the MVC app is closer to the physical structure.</p>
<p>So, I implemented area’s with a specific AreaViewEngine that can lookup views based on the area name and added the extension to the RouteCollection class to add area information when mapping routes. This is how Global.asax.cs looks:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #0000ff">protected</span> <span style="color: #0000ff">void</span> Application_Start(<span style="color: #0000ff">object</span> sender, EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">{</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    ViewEngines.Engines.Clear();</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    ViewEngines.Engines.Add(<span style="color: #0000ff">new</span> AreaViewEngine());</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">&#160;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    <span style="color: #008000">// Routes</span></pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    RegisterRoutes(RouteTable.Routes);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">}</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">&#160;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> RegisterRoutes(RouteCollection routes)</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">{</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    routes.IgnoreRoute(<span style="color: #006080">&quot;{resource}.axd/{*pathInfo}&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    routes.IgnoreRoute(<span style="color: #006080">&quot;{*favicon}&quot;</span>, <span style="color: #0000ff">new</span> { favicon = <span style="color: #006080">@&quot;(.*/)?favicon.ico(/.*)?&quot;</span> });</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">&#160;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    routes.CreateArea(<span style="color: #006080">&quot;mymvcapp&quot;</span>, <span style="color: #006080">&quot;WebFormsMVCDemo.MyMvcApp.Controllers&quot;</span>,</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">        routes.MapRoute(<span style="color: #006080">&quot;mymvcapp-defaultroute&quot;</span>, <span style="color: #006080">&quot;mymvcapp/{controller}/{action}/{id}&quot;</span>, <span style="color: #0000ff">new</span> { action = <span style="color: #006080">&quot;Index&quot;</span>, controller = <span style="color: #006080">&quot;Home&quot;</span>, id = <span style="color: #006080">&quot;&quot;</span> })</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    );</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">}</pre>
<p><!--CRLF--></div>
</div>
<p>With the ViewEngine and routes in place, we’re able to run the MVC app from the url /mymvcapp. To make sure the WebForms url’s still work, we just have to add some ignore statements in Global.asax.cs (in our case, exclude .aspx and .ashx from routing):</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> RegisterRoutes(RouteCollection routes)</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">{</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    routes.IgnoreRoute(<span style="color: #006080">&quot;{resource}.axd/{*pathInfo}&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    routes.IgnoreRoute(<span style="color: #006080">&quot;{*allaspx}&quot;</span>, <span style="color: #0000ff">new</span> { allaspx = <span style="color: #006080">@&quot;.*\.aspx(/.*)?&quot;</span> });</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    routes.IgnoreRoute(<span style="color: #006080">&quot;{*allashx}&quot;</span>, <span style="color: #0000ff">new</span> { allashx = <span style="color: #006080">@&quot;.*\.ashx(/.*)?&quot;</span> });</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    routes.IgnoreRoute(<span style="color: #006080">&quot;{*favicon}&quot;</span>, <span style="color: #0000ff">new</span> { favicon = <span style="color: #006080">@&quot;(.*/)?favicon.ico(/.*)?&quot;</span> });</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">&#160;</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    routes.CreateArea(<span style="color: #006080">&quot;mymvcapp&quot;</span>, <span style="color: #006080">&quot;WebFormsMVCDemo.MyMvcApp.Controllers&quot;</span>,</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">        routes.MapRoute(<span style="color: #006080">&quot;mymvcapp-defaultroute&quot;</span>, <span style="color: #006080">&quot;mymvcapp/{controller}/{action}/{id}&quot;</span>, <span style="color: #0000ff">new</span> { action = <span style="color: #006080">&quot;Index&quot;</span>, controller = <span style="color: #006080">&quot;Home&quot;</span>, id = <span style="color: #006080">&quot;&quot;</span> })</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    );</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">}</pre>
<p><!--CRLF--></div>
</div>
<p>One caveat: when performing the request for /mymvcapp without controller name (and action), the Default.aspx that comes with the MVC projects was loaded, but area’s seem so cause a problem with the default one. Instead of rewriting the url from ‘default.aspx’ to ‘/’, I had to rewrite to url to ‘Home/Index’:</p>
<div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4; text-align: left">
<div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"><span style="color: #0000ff">public</span> <span style="color: #0000ff">partial</span> <span style="color: #0000ff">class</span> _Default : Page</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">{</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> Page_Load(<span style="color: #0000ff">object</span> sender, System.EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">    {</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">        <span style="color: #0000ff">string</span> pathToRewriteTo = Request.Path.ToLowerInvariant().Replace(<span style="color: #006080">&quot;default.aspx&quot;</span>, <span style="color: #006080">&quot;Home/Index&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">        HttpContext.Current.RewritePath(pathToRewriteTo, <span style="color: #0000ff">false</span>);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">        IHttpHandler httpHandler = <span style="color: #0000ff">new</span> MvcHttpHandler();</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">        httpHandler.ProcessRequest(HttpContext.Current);</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none">    }</pre>
<p><!--CRLF--></p>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none">}</pre>
<p><!--CRLF--></div>
</div>
<p>I’m under the impression that I’m missing something very simple, but couldn’t get my fingers behind it, so if you know it, please comment.</p>
<p>&#160;</p>
<p>That’s it. I created a sample project with both WebForms and an MVC app in a subfolder. <a href="http://blogs.taiga.nl/martijn/wp-content/uploads/WebFormsMVCDemo.zip" target="_blank">You can download it here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/06/03/aspnet-webforms-and-mvc-together-in-one-project/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC bridging the gap with PHP development?</title>
		<link>http://blogs.taiga.nl/martijn/2009/05/07/aspnet-mvc-bridging-the-gap-with-php-development/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/05/07/aspnet-mvc-bridging-the-gap-with-php-development/#comments</comments>
		<pubDate>Thu, 07 May 2009 15:01:49 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/2009/05/07/aspnet-mvc-bridging-the-gap-with-php-development/</guid>
		<description><![CDATA[For a long time, there has been a distinct separation between ASP.NET and PHP developers. The platforms have been so fundamentally different and also have the surrounding cultures. Generally speaking, ASP.NET developers consider the PHP guys script kiddies with no real understanding of ‘real’ software development and the PHP guys saw ASP.NET developers as some [...]]]></description>
			<content:encoded><![CDATA[<p><img title="Grand_Canyon6" style="display: inline" height="160" alt="Grand_Canyon6" src="http://blogs.taiga.nl/martijn/wp-content/uploads/2009/05/grand-canyon61.jpg" width="240" align="right" /> For a long time, there has been a distinct separation between <a href="http://www.asp.net">ASP.NET</a> and <a href="http://www.php.net">PHP</a> developers. The platforms have been so fundamentally different and also have the surrounding cultures. Generally speaking, ASP.NET developers consider the PHP guys script kiddies with no real understanding of ‘real’ software development and the PHP guys saw ASP.NET developers as some M$ infected bunch of people that have no clue of web standards, clean HTML or how to build a proper web app at all.</p>
<p>But times have changed. Both platforms are moving. PHP now has a whole bunch of application frameworks (<a href="http://framework.zend.com/">Zend</a>, <a href="http://cakephp.org/">CakePHP</a> etc.) that encourage good application design and also since PHP 5, the programming language has improved a lot. On the other hand, with the release of ASP.NET MVC, it has become much more easy to render clean HTML and we can finally leverage all the cool client-side toolkits that are out there without having to work around the quirks of <a href="http://stackoverflow.com/questions/46031/why-does-the-aspnet-web-forms-model-suck">Web Forms</a>.&#160; </p>
<p>So, with this movement, we see that both platforms grow towards each other. More and more developers come to have a look over the fence to see what’s happening at the neighbours place.<img title="bridge-gap" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="159" alt="bridge-gap" src="http://blogs.taiga.nl/martijn/wp-content/uploads/2009/05/bridgegap1.jpg" width="240" border="0" /></p>
<p>Two concrete examples:</p>
<ul>
<li>I’m consulting a little at a PHP shop that is moving towards .NET. They found Visual Studio and C# very cool, but the Web Forms issues regarding clean HTML etc. made it an absolute no-go. ASP.NET MVC is what made them switch.</li>
<li>Just watched the <a href="http://videos.visitmix.com/MIX09/T62F">ASP.NET MVC Mix 09 presentation</a> of <a href="http://blog.wekeroad.com/">Rob Conery</a> (Microsoft) and he showed lots of things that were clearly inspired by how PHP apps like <a href="http://wordpress.org">WordPress</a> work.</li>
</ul>
<ul>I like this movement! As a .NET developer, I find it very refreshing and inspiring to mix and mingle with ‘the other side’. There is a lot we can learn from each other to make better web applications.</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/05/07/aspnet-mvc-bridging-the-gap-with-php-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ASP.NET development is like my pedalboard</title>
		<link>http://blogs.taiga.nl/martijn/2009/03/19/aspnet-development-is-like-my-pedalboard/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/03/19/aspnet-development-is-like-my-pedalboard/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 21:46:18 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Guitar]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/2009/03/19/aspnet-development-is-like-my-pedalboard/</guid>
		<description><![CDATA[Warning: this post doesn’t only contain the usual software dev stuff, but also some serious guitar-geekiness. This morning, I was shocked when I found out how much the development of my pedalboard went through exactly the same stages as the way I’m building ASP.NET web applications. First let’s see where I’m coming from: In the [...]]]></description>
			<content:encoded><![CDATA[<p><em>Warning: this post doesn’t only contain the usual software dev stuff, but also some serious guitar-geekiness.</em></p>
<p>This morning, I was shocked when I found out how much the development of my <a href="http://en.wikipedia.org/wiki/Guitar_pedalboard">pedalboard</a> went through exactly the same stages as the way I’m building ASP.NET web applications. First let’s see where I’m coming from:</p>
<p><img title="pedalboard-before" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="225" alt="pedalboard-before" src="http://blogs.taiga.nl/martijn/wp-content/uploads/2009/03/pedalboardbefore.jpg" width="300" border="0" /> </p>
<p>In the picture above you can see a large yellow device. This is the <a href="http://bx.line6.com/dm4/">Line 6 Distortion Modeler</a>. It claims that it can produce all the classic distorted guitar tones that you’ll ever want and to a certain extend this is true. The sound is alright and the possibilities are huge. But also: the output (sound wise) that this device produces is always less than the original pedals that it’s trying to emulate. Also, the switches are a little bit unreliable and cause a little gap when changing sounds. I tried to fix this, but the device is very inaccessible and doesn’t lend itself very well for modifications or extensions.</p>
<h3>Less is better</h3>
<p>These days I’m back to where I came from: two simple pedals that don’t have a gazillion options but just do their work and are very efficient:</p>
<p><img title="pedalboard-after" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="270" alt="pedalboard-after" src="http://blogs.taiga.nl/martijn/wp-content/uploads/2009/03/pedalboardafter.jpg" width="360" border="0" /> </p>
<p>On the left we have the <a href="http://www.procosound.com/?page=viewprod&amp;cat=150&amp;id=741">Proco RAT</a> and on the right it’s the <a href="http://www.digitech.com/products/Pedals/BadMonkey.php">Digitech Bad Monkey</a> (‘told you we’d have some guitar-geek talk in this post, remember?). These guys are simple, reliable and their output is just the way I want my distortion to sound without losing dynamics and tone. Full control!</p>
<p><em>So, what does this have to do with ASP.NET web development?</em></p>
<p>Nothing of course <img src='http://blogs.taiga.nl/martijn/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It just struck me that at about the same time I switched from ASP.NET Webforms to MVC, I also changed my pedalboard to accomplish the same result: making the end result better with a more simplistic approach. The yellow monster in the first picture is like Webforms with ASP.NET AJAX where I have a love-hate relationship with. The two pedals in de second picture feel like the MVC and jQuery combination (loosely coupled, only connected with a little patch cable), that brought a lot of fun lately and work very well for me.</p>
<p><em>Yeah, great analogy, NOT! I didn’t subscribe to read this blah about some guitar thingy.</em></p>
<p>Well it just something that went through my mind this morning and writing about it also gives me a chance to post some crappy gear pictures, like it or not. Here’s another one for free:</p>
<p><img title="family" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="300" alt="family" src="http://blogs.taiga.nl/martijn/wp-content/uploads/2009/03/family.jpg" width="225" border="0" /> </p>
<p> <img src='http://blogs.taiga.nl/martijn/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>P.S. the empty spot above the pedals is normally reserved for my <a href="http://www.ehx.com/products/deluxe-memory-man">Electro Harmonix Memory Man Deluxe</a> but this drama queen is broken at the moment and deserves a single post of its own.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/03/19/aspnet-development-is-like-my-pedalboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How can we make the SharePoint world a better world?</title>
		<link>http://blogs.taiga.nl/martijn/2009/02/20/how-can-we-make-the-sharepoint-world-a-better-world/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/02/20/how-can-we-make-the-sharepoint-world-a-better-world/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 16:37:41 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/?p=63</guid>
		<description><![CDATA[Lots of companies are positioning SharePoint as their preferred platform for everything that has to do with the web, both intranet and public facing websites. Now out-of-the-box, SharePoint delivers excellent value, but when building custom functionality or public facing sites, there are some serious issues. My biggest gripes are: The whole development experience is awful. [...]]]></description>
			<content:encoded><![CDATA[<p>Lots of companies are positioning SharePoint as their preferred platform for everything that has to do with the web, both intranet and public facing websites. Now out-of-the-box, SharePoint delivers excellent value, but when building custom functionality or public facing sites, there are some serious issues.</p>
<p>My biggest gripes are:</p>
<ul>
<li>The whole development experience is awful. Yes, you can create custom webparts, but I&#8217;ve yet to come across the one that isn&#8217;t a <a href="http://en.wikipedia.org/wiki/Big_ball_of_mud" target="_blank">big ball of mud</a>. Also, the entire cycle of compiling, deploying and testing takes way too long to be productive at all. One minute is pretty common. Gosh, I wonder why all these projects are late every time <img src='http://blogs.taiga.nl/martijn/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ;</li>
<li>The HTML output is a mess. Not so much a problem for intranets, but for public sites it is. With a zillion tweaks, it is possible to fix it, but then again, no wonder these projects are late every time;</li>
</ul>
<p>I&#8217;ve been thinking how to improve this situation. Sure, I could say: &#8220;just don&#8217;t use SharePoint for your public web sites&#8221;, but companies are going to push everything to Sharepoint anyway. The whitepapers and consultants will tell them that everything is possible and it&#8217;s from Microsoft, so it&#8217;s a safe bet. We (as in Microsoft developers) simply have to deal with it the next years.</p>
<h3>A Cunning Plan</h3>
<p>First: let&#8217;s focus on publishing sites. I want to have:</p>
<ul>
<li>Clean standards-based HTML;</li>
<li>Clean url&#8217;s;</li>
<li>The ability to add custom applications as a feature without being restricted to webparts, or even better: develop applications standalone and deploy to Sharepoint when they&#8217;re ready;</li>
<li>Leverage the SharePoint infrastructure (sites, lists, security, etc);</li>
</ul>
<p>Looks impossible but is it really?</p>
<p>Couldn&#8217;t we not drop in System.Web.Routing, create a special SharePointRouteHandler, that sets up required sharepoint infrastructure and delegates the request to a Controller to have ASP.NET MVC within the SharePoint context? I think it&#8217;s hard and complex, but not impossible. We could leverage all strong points of ASP.NET MVC like separation of concerns, testability, clean HTML together with the huge foundation that SharePoint offers.</p>
<h3>Plan B</h3>
<p>Microsoft is already working on this situation and the next version of SharePoint will address the situation properly.</p>
<p>Now, please tell me that I&#8217;m <strong>a</strong>: ambitious, <strong>b</strong>: naive or <strong>c</strong>: completely insane <img src='http://blogs.taiga.nl/martijn/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/02/20/how-can-we-make-the-sharepoint-world-a-better-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Paging demo upgraded to ASP.NET MVC RC</title>
		<link>http://blogs.taiga.nl/martijn/2009/02/04/paging-demo-upgraded-to-aspnet-mvc-rc/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/02/04/paging-demo-upgraded-to-aspnet-mvc-rc/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 11:04:53 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Paging]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/2009/02/04/paging-demo-upgraded-to-aspnet-mvc-rc/</guid>
		<description><![CDATA[The sample project that belongs to the Paging with ASP.NET MVC post is upgraded to ASP.NET MVC RC. Get it from here.]]></description>
			<content:encoded><![CDATA[<p>The sample project that belongs to <a href="http://blogs.taiga.nl/martijn/2008/08/27/paging-with-aspnet-mvc/" target="_blank">the Paging with ASP.NET MVC post</a> is upgraded to ASP.NET MVC RC. <a href="http://blogs.taiga.nl/martijn/wp-content/uploads/2008/08/mvcpaging-rc1.zip">Get it from here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/02/04/paging-demo-upgraded-to-aspnet-mvc-rc/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Paging demo upgraded to ASP.NET MVC Beta</title>
		<link>http://blogs.taiga.nl/martijn/2009/01/16/paging-demo-upgraded-to-aspnet-mvc-beta/</link>
		<comments>http://blogs.taiga.nl/martijn/2009/01/16/paging-demo-upgraded-to-aspnet-mvc-beta/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 11:48:10 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Paging]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/archive/2009/01/16/paging-demo-upgraded-to-asp.net-mvc-beta.aspx</guid>
		<description><![CDATA[The post about paging in ASP.NET MVC still gets many hits, but the demo was created with ASP.NET MVC preview 5, so therefore I upgraded the demo to ASP.NET MVC Beta. I also removed a little bug that occurred when paging an already filtered list. You can download the updated demo here.]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://blogs.taiga.nl/martijn/2008/08/27/paging-with-asp.net-mvc">post about paging in ASP.NET MVC</a> still gets many hits, but the demo was created with ASP.NET MVC preview 5, so therefore I upgraded the demo to ASP.NET MVC Beta. I also removed a little bug that occurred when paging an already filtered list.</p>
<p><a href="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/mvcpaging-mvc-beta.zip" target="_blank">You can download the updated demo here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2009/01/16/paging-demo-upgraded-to-aspnet-mvc-beta/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Validation in ASP.NET MVC &#8211; part 4: example with server-side and client-side validation</title>
		<link>http://blogs.taiga.nl/martijn/2008/12/08/validation-in-aspnet-mvc-part-4-example-with-server-side/</link>
		<comments>http://blogs.taiga.nl/martijn/2008/12/08/validation-in-aspnet-mvc-part-4-example-with-server-side/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 21:18:15 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Sample]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/archive/2008/12/08/validation-in-asp.net-mvc-part-4-example-with-server-side.aspx</guid>
		<description><![CDATA[This is part 4 of a series of posts. See also: Validation in ASP.NET MVC &#8211; part 1: basic server-side validation Validation in ASP.NET MVC &#8211; part 2: custom server-side validation Validation in ASP.NET MVC &#8211; part 3: client-side validation with jQuery validation In the previous posts, I described how we implemented model-based validation on [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 4 of a series of posts. See also:</p>
<ul>
<li><a href="http://blogs.taiga.nl/martijn/2008/11/26/validation-in-asp.net-mvc-part-1-basic-server-side-validation">Validation in ASP.NET MVC &#8211; part 1: basic server-side validation</a></li>
<li><a href="http://blogs.taiga.nl/martijn/2008/11/27/validation-in-asp.net-mvc-part-2-custom-server-side-validation">Validation in ASP.NET MVC &#8211; part 2: custom server-side validation</a></li>
<li><a href="http://blogs.taiga.nl/martijn/2008/12/08/validation-in-asp.net-mvc-part-3-client-side-validation-with">Validation in ASP.NET MVC &#8211; part 3: client-side validation with jQuery validation</a></li>
</ul>
<p>In the previous posts, I described how we implemented model-based validation on the server-side in <a href="http://cuyahoga-project.org" target="_blank">Cuyahoga</a> with ASP.NET MVC and as the icing on the cake, we also added some client-side validation (also model-based).</p>
<p>Now, everything can be found in the <a href="https://cuyahoga.svn.sourceforge.net/svnroot/cuyahoga/trunk/" target="_blank">Cuyahoga SVN sources</a> but I have to agree that it can be a daunting task to check out the complete sources and find all pieces of the validation puzzle. Therefore, I&#8217;ve created a little sample application with everything from the previous posts combined.</p>
<p><a href="http://blogs.taiga.nl/images/blogs_taiga_nl/martijn/WindowsLiveWriter/Val.NETMVCpart4examplewithserversideandc_13761/validation-sample-app_2.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/WindowsLiveWriter/Val.NETMVCpart4examplewithserversideandc_13761/validation-sample-app_thumb.png" border="0" alt="validation-sample-app" width="644" height="484" /></a></p>
<p>Hopefully, this will make things a little bit clearer. <a href="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/MvcValidationSample.zip" target="_blank">You can download the sample app here</a>. Visual Studio 2008 and <a href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=a24d1e00-cd35-4f66-baa0-2362bdde0766&amp;displaylang=en" target="_blank">ASP.NET MVC Beta</a> are required.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2008/12/08/validation-in-aspnet-mvc-part-4-example-with-server-side/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Validation in ASP.NET MVC &#8211; part 3: client-side validation with jquery validation</title>
		<link>http://blogs.taiga.nl/martijn/2008/12/08/validation-in-aspnet-mvc-part-3-client-side-validation-with/</link>
		<comments>http://blogs.taiga.nl/martijn/2008/12/08/validation-in-aspnet-mvc-part-3-client-side-validation-with/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:09:19 +0000</pubDate>
		<dc:creator>martijn</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Cuyahoga]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Validation]]></category>

		<guid isPermaLink="false">http://blogs.taiga.nl/martijn/archive/2008/12/08/validation-in-asp.net-mvc-part-3-client-side-validation-with.aspx</guid>
		<description><![CDATA[This is part 3 of a series of posts. See also: Validation in ASP.NET MVC &#8211; part 1: basic server-side validation Validation in ASP.NET MVC &#8211; part 2: custom server-side validation In the first two parts, I showed how you can perform validation on the server side with Castle Validation attributes and extend that model [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 3 of a series of posts. See also:</p>
<ul>
<li><a href="http://blogs.taiga.nl/martijn/2008/11/26/validation-in-asp.net-mvc-part-1-basic-server-side-validation">Validation in ASP.NET MVC &#8211; part 1: basic server-side validation</a></li>
<li><a href="http://blogs.taiga.nl/martijn/2008/11/27/validation-in-asp.net-mvc-part-2-custom-server-side-validation">Validation in ASP.NET MVC &#8211; part 2: custom server-side validation</a></li>
</ul>
<p>In the first two parts, I showed how you can perform validation on the server side with Castle Validation attributes and extend that model with custom validation logic. With this, we have everything we need to properly validate our model.</p>
<p>For a better user experience though, it would also be nice that we could re-use (part of) our validation logic on the client-side. Luckily, lots of others have already looked into this and the only thing I had to do was to throw everything together and stir it a little bit <img src='http://blogs.taiga.nl/martijn/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>The ingredients are:</p>
<ul>
<li><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" target="_blank">The jQuery validation plugin</a> (an obvious choice, since we were already using jQuery in <a href="http://cuyahoga-project.org" target="_blank">Cuyahoga</a>);</li>
<li><a href="http://svn.castleproject.org:8080/svn/castle/trunk/MonoRail/Castle.MonoRail.Framework/Helpers/ValidationStrategy" target="_blank">Monorail client-side code generator for jQuery validation</a> (originally contributed by Gildas, but also many credits to the Castle Monorail guys for creating such a flexible infrastructure);</li>
<li><a href="http://blog.codeville.net/2008/04/30/model-based-client-side-validation-for-aspnet-mvc/">Model-based Client-side Validation for ASP.NET MVC</a> (very inspiring blog post by Steve Sanderson).</li>
</ul>
<h3>How it works</h3>
<h3><a href="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/WindowsLiveWriter/Val.NETMVCpart3clientsidevalidationwithj_CA52/client-side-validation-1_2.png"><img style="border: 0pt none;" src="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/WindowsLiveWriter/Val.NETMVCpart3clientsidevalidationwithj_CA52/client-side-validation-1_thumb.png" border="0" alt="client-side-validation-1" /></a></h3>
<ol>
<li>The client-side validation is called via an HtmlHelper extension method ClientSideValidation:<br />
&lt;%= Html.ClientSideValidation(ViewData.Model, &#8220;my_form_id&#8221;)%&gt;;</li>
<li>The HtmlHelper extension requests an instance of a BrowserValidationEngine that returns the client script for validation;</li>
<li>BrowserValidationEngine has a reference to an IValidatorRegistry instance that returns all (Castle) validators for the given model;</li>
<li>For each validator, the referenced IBrowserValidatorProvider generates the appropriate client script;</li>
<li>Finally, all generated client script code is combined and sent to the browser in a single javascript block.</li>
</ol>
<p>The existing Monorail codebase proved to be of great value and could be used almost seamlessly. The only difference is the way the client code is generated. Originally, the validators generated css class attributes for the Monorail form helpers, but we don&#8217;t have those with ASP.NET MVC, so all client code is generated as jQuery validation rules.</p>
<p>Below, you can see the output of the validation helper for the new user form in Cuyahoga:</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">&lt;script type=<span style="color: #006080">"text/javascript"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">$(document).ready(function() {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    jQuery.validator.addMethod(<span style="color: #006080">'notEqualTo'</span>, function(<span style="color: #0000ff">value</span>, element, param) { <span style="color: #0000ff">return</span> <span style="color: #0000ff">value</span> != jQuery(param).val(); }, <span style="color: #006080">'Must not be equal to {0}.'</span> );</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    jQuery.validator.addMethod(<span style="color: #006080">'greaterThan'</span>, function(<span style="color: #0000ff">value</span>, element, param) { <span style="color: #0000ff">return</span> ( IsNaN( <span style="color: #0000ff">value</span> ) &amp;&amp; IsNaN( jQuery(param).val() ) ) || ( <span style="color: #0000ff">value</span> &gt; jQuery(param).val() ); }, <span style="color: #006080">'Must be greater than {0}.'</span> );</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    jQuery.validator.addMethod(<span style="color: #006080">'lesserThan'</span>, function(<span style="color: #0000ff">value</span>, element, param) { <span style="color: #0000ff">return</span> ( IsNaN( <span style="color: #0000ff">value</span> ) &amp;&amp; IsNaN( jQuery(param).val() ) ) || ( <span style="color: #0000ff">value</span> &lt; jQuery(param).val() ); }, <span style="color: #006080">'Must be lesser than {0}.'</span> );</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    jQuery.validator.addMethod(<span style="color: #006080">'numberNative'</span>, function(<span style="color: #0000ff">value</span>, element, param) { <span style="color: #0000ff">return</span> <span style="color: #0000ff">this</span>.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:\,\d+)?$/.test(<span style="color: #0000ff">value</span>); }, <span style="color: #006080">'Not a valid number.'</span> );</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    jQuery.validator.addMethod(<span style="color: #006080">'simpleDate'</span>, function(<span style="color: #0000ff">value</span>, element, param) { <span style="color: #0000ff">return</span> <span style="color: #0000ff">this</span>.optional(element) || /^\d{1,2}\-\d{1,2}\-\d{4}$/.test(<span style="color: #0000ff">value</span>); }, <span style="color: #006080">'Not a valid date.'</span> );</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    $(<span style="color: #006080">"#userform"</span>).validate({</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        rules : {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            UserName: {  rangelength: [1, 50] , required: <span style="color: #0000ff">true</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            Password: {   required: <span style="color: #0000ff">true</span> , rangelength: [5, 50] , equalTo: <span style="color: #006080">"#PasswordConfirmation"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            PasswordConfirmation: {   equalTo: <span style="color: #006080">"#Password"</span> , rangelength: [5, 50] , required: <span style="color: #0000ff">true</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            FirstName: { rangelength: [1, 100] },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            LastName: { rangelength: [1, 100] },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            Email: {   required: <span style="color: #0000ff">true</span> , rangelength: [1, 100] , email: <span style="color: #0000ff">true</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            Website: { rangelength: [1, 100] }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        messages : {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            UserName: {  rangelength: <span style="color: #006080">"The username must be between 1 and 50 characters"</span> , required: <span style="color: #006080">"The username may not be empty"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            Password: {   required: <span style="color: #006080">"The password may not be empty"</span> , rangelength: <span style="color: #006080">"The password must contain at least 5 characters"</span> , equalTo: <span style="color: #006080">"The password must be the same as the confirmation password"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            PasswordConfirmation: {   equalTo: <span style="color: #006080">"The password must be the same as the confirmation password"</span> , rangelength: <span style="color: #006080">"The password must contain at least 5 characters"</span> , required: <span style="color: #006080">"The password confirmation may not be empty"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            FirstName: { rangelength: <span style="color: #006080">"The firstname must be between 1 and 100 characters"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            LastName: { rangelength: <span style="color: #006080">"The lastname must be between 1 and 100 characters"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            Email: {   required: <span style="color: #006080">"E-mail address may not be empty"</span> , rangelength: <span style="color: #006080">"E-mail address must be between 1 and 100 characters"</span> , email: <span style="color: #006080">"Invalid e-mail address"</span> },</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            Website: { rangelength: <span style="color: #006080">"The website url must be between 1 and 100 characters"</span> }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    });</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">});</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">&lt;/script&gt;</pre>
</div>
</div>
<p>which results in this:</p>
<p><a href="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/WindowsLiveWriter/Val.NETMVCpart3clientsidevalidationwithj_CA52/client-side-validation-2_2.png"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://blogs.taiga.nl/martijn/wp-content/uploads/subtext/WindowsLiveWriter/Val.NETMVCpart3clientsidevalidationwithj_CA52/client-side-validation-2_thumb.png" border="0" alt="client-side-validation-2" width="644" height="484" /></a></p>
<h3>Summarizing validation</h3>
<p>In this series of posts, I showed how we deal with validation in Cuyahoga and ASP.NET MVC. Personally, I think the nicest part of it is that we have our validation rules centralized and we only have to add one line of code to the view to enable client-side validation.</p>
<p>The code can be found in <a href="https://cuyahoga.svn.sourceforge.net/svnroot/cuyahoga/trunk/" target="_blank">Cuyahoga SVN</a> and more specifically in the <a href="https://cuyahoga.svn.sourceforge.net/svnroot/cuyahoga/trunk/Core/Validation/" target="_blank">validation</a> <a href="https://cuyahoga.svn.sourceforge.net/svnroot/cuyahoga/trunk/Cuyahoga.Web.Mvc/Validation/" target="_blank">sections</a> and the <a href="https://cuyahoga.svn.sourceforge.net/svnroot/cuyahoga/trunk/Web/Manager/" target="_blank">ASP.NET MVC manager</a>. I&#8217;ll try to make a standalone sample project with all the validation stuff somewhere in the near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.taiga.nl/martijn/2008/12/08/validation-in-aspnet-mvc-part-3-client-side-validation-with/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
