<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Dan Miser - ASP.NET MVC</title>
    <link>http://www.distribucon.com/blog/</link>
    <description>Thoughts from Dan Miser</description>
    <language>en-us</language>
    <copyright>Dan Miser</copyright>
    <lastBuildDate>Thu, 08 Nov 2012 21:11:20 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>dmiser@distribucon.com</managingEditor>
    <webMaster>dmiser@distribucon.com</webMaster>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=f9f8c5ab-8b54-485f-9dfa-f1b486de4263</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,f9f8c5ab-8b54-485f-9dfa-f1b486de4263.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,f9f8c5ab-8b54-485f-9dfa-f1b486de4263.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f9f8c5ab-8b54-485f-9dfa-f1b486de4263</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">The new DisplayMode engine in ASP.NET MVC
4 is rather nice. By default, it will detect whether you come in from a mobile device
or a desktop machine, and load up a specialized view for you based on that detection. 
<p></p>
For example, if you were trying to navigate to http://www.example.com/Players from
an iPhone, the default behavior will be to look for Players\Index.Mobile.cshtml, followed
by Players\Index.cshtml. Whichever it finds first will be the view that gets used.
Note that this also requires you to have a _Layout.Mobile.cshtml file. 
<p></p>
This is great for new projects, but I have a non-trivial app with a lot of views that
have been built over the years using the technique by <a href="http://www.distribucon.com/blog/MobileCapableWebFormViewEngineUpdate.aspx">Scott
Hanselman</a>. That approach would look for the file in Players\Mobile\Index.cshtml.
I was not looking forward to renaming all of those files. 
<p></p>
In order to use my already existing file structure, I added one class: 
<p></p><pre><code> public class SubfolderDisplayMode : DefaultDisplayMode { public SubfolderDisplayMode()
: base("Mobile") { // Be sure to use 51degrees.mobi, or a good browser capabilities
file ContextCondition = (context =&gt; context.GetOverriddenBrowser().IsMobileDevice);
} protected override string TransformPath(string virtualPath, string suffix) { var
dir = VirtualPathUtility.GetDirectory(virtualPath); var filename = VirtualPathUtility.GetFileName(virtualPath);
return VirtualPathUtility.Combine(dir, "Mobile/" + filename); } } </code></pre><p></p>
Registered it in my Globabl.asax.cs: <pre><code> DisplayModeProvider.Instance.Modes.Insert(0,
new SubfolderDisplayMode()); </code></pre><p></p>
It works very well, and I can come back and rename those files later. 
<p></p>
Also be sure to put a call to @Html.Partial("_VewSwitcher") somewhere in your desktop
_Layou.cshtml file so the user can get back to the mobile version of the site. 
<p></p><i>Updated on 11/9/12 to clean the sample code up a bit</i><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=f9f8c5ab-8b54-485f-9dfa-f1b486de4263" /></body>
      <title>DisplayMode to load views from a subfolder</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,f9f8c5ab-8b54-485f-9dfa-f1b486de4263.aspx</guid>
      <link>http://www.distribucon.com/blog/DisplayModeToLoadViewsFromASubfolder.aspx</link>
      <pubDate>Thu, 08 Nov 2012 21:11:20 GMT</pubDate>
      <description>The new DisplayMode engine in ASP.NET MVC 4 is rather nice. By default, it will detect whether you come in from a mobile device or a desktop machine, and load up a specialized view for you based on that detection.
&lt;p&gt;
&lt;/p&gt;
For example, if you were trying to navigate to http://www.example.com/Players from
an iPhone, the default behavior will be to look for Players\Index.Mobile.cshtml, followed
by Players\Index.cshtml. Whichever it finds first will be the view that gets used.
Note that this also requires you to have a _Layout.Mobile.cshtml file. 
&lt;p&gt;
&lt;/p&gt;
This is great for new projects, but I have a non-trivial app with a lot of views that
have been built over the years using the technique by &lt;a href="http://www.distribucon.com/blog/MobileCapableWebFormViewEngineUpdate.aspx"&gt;Scott
Hanselman&lt;/a&gt;. That approach would look for the file in Players\Mobile\Index.cshtml.
I was not looking forward to renaming all of those files. 
&lt;p&gt;
&lt;/p&gt;
In order to use my already existing file structure, I added one class: 
&lt;p&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; public class SubfolderDisplayMode : DefaultDisplayMode { public SubfolderDisplayMode()
: base("Mobile") { // Be sure to use 51degrees.mobi, or a good browser capabilities
file ContextCondition = (context =&gt; context.GetOverriddenBrowser().IsMobileDevice);
} protected override string TransformPath(string virtualPath, string suffix) { var
dir = VirtualPathUtility.GetDirectory(virtualPath); var filename = VirtualPathUtility.GetFileName(virtualPath);
return VirtualPathUtility.Combine(dir, "Mobile/" + filename); } } &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
Registered it in my Globabl.asax.cs: &lt;pre&gt;&lt;code&gt; DisplayModeProvider.Instance.Modes.Insert(0,
new SubfolderDisplayMode()); &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
It works very well, and I can come back and rename those files later. 
&lt;p&gt;
&lt;/p&gt;
Also be sure to put a call to @Html.Partial("_VewSwitcher") somewhere in your desktop
_Layou.cshtml file so the user can get back to the mobile version of the site. 
&lt;p&gt;
&lt;/p&gt;
&lt;i&gt;Updated on 11/9/12 to clean the sample code up a bit&lt;/i&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=f9f8c5ab-8b54-485f-9dfa-f1b486de4263" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,f9f8c5ab-8b54-485f-9dfa-f1b486de4263.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=6270ff06-aca1-4828-a4a8-5237411f5455</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,6270ff06-aca1-4828-a4a8-5237411f5455.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,6270ff06-aca1-4828-a4a8-5237411f5455.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6270ff06-aca1-4828-a4a8-5237411f5455</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">After installing the RTM version of VS2012
last week and upgrading my project, I noticed that my web site was broken. The real
culprit seemed to be that Microsoft changed how bundling works (the process of combining
and minifying resources like js script and css files) between the RC version and the
RTM version. For an excellent background on what this feature can do for you, see <a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification">this
tutorial</a>. 
<p />
It turns out my real problem was with Kendo. They don't provide non-minified files
in the trial version, so the new bundling mechanism wasn't including the minified
assets, which meant the Kendo minified assets were getting stripped out when I was
trying to run under debug. (<a href="http://www.kendoui.com/forums/mvc/general-discussions/vs2012-rtm-mvc4-kendo-bundle-not-rendering.aspx">Reference
here</a>). I was able to use the work-around offered on this thread, and things started
working again. 
<p />
However, there are a few wrinkles when using the bundling code, so I thought I'd capture
my experiences here. For example: 
<ul><li>
For 3rd party components that don't ship with non-minified assets, you need a better
way around the default bundling strategy provided in the kendo article above. The
solution provided in that thread of removing the min files from the ignore list will
end up duplicating other assets that do provide both a minified and regular version
of their assets while running in debug mode, e.g. jquery. There is a workaround for
this, though: If you specify your bundle file's pattern with the {version} macro,
then the bundling framework is smart enough to include just the one copy of the asset.
If you use a wildcard in the pattern (as shown in the thread), you will get duplicate
min and non-min versions of the asset when you render. Here is what your code should
look like: <pre><code> bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); </code></pre></li><li>
When specifying a CDN location, right now, you can't use the {version} macro, so you
end up with a hardcoded reference for your CDN link (1.7.1 in the sample) and a {version}
macro for the non-CDN reference (which could be 1.7.1, 1.7.2, or anything else that
exists in your solution). This means that when you update locally, you need to remember
to keep those version numbers in sync. The CDN path could take the version you have
locally and substitute it in the CDN path that you provide removing this requirement. 
</li><li>
In the tutorial, there is a fallback script that they recommend you write after your
Scripts.Render statement so you can gracefully fall back to the local version if the
CDN version doesn't load. It would be much better if that fallback code would be emitted
for you when you call Scripts.Render. 
</li><li>
Speaking of CDN, it appears that there is a very tight coupling assumed between a
bundle and a CDN path. In other words, you cannot include multiple assets in one bundle
because the CDN path for the bundle assumes it is a reference to a specific file on
the CDN. It would be better to have CDN paths be tied to each individual item in the
bundle. 
</li><li>
Also relating to CDN support: The CDN path will only be used if you set bundles.UseCDN
to true <b>AND</b> you either have BundleTables.EnableOptimization set to true or
compilation debug set to false in your web.config. Granted, you probably only want
to use the CDN when you are pushing to production, but while trying to test things
out, I was doing it locally and this caught me by surprise. The 2 items should be
independent of each other. If not, why even bother having the UseCDN property? 
</li></ul><p />
It seems that there is quite a bit of friction in the current version of the bundling
framework. Fortunately, it resides in the Optimization assembly which can be upgraded
independently of the entire MVC framework. I hope Microsoft releases an update very
soon to overcome these obstacles. I have every reason to believe that they will since
I'm seeing <a href="http://stackoverflow.com/users/1459890/hao-kung">the author of
this assembly</a> answering tons of questions on StackOverflow. <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=6270ff06-aca1-4828-a4a8-5237411f5455" /></body>
      <title>Bundling for web assets in ASP.NET MVC 4</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,6270ff06-aca1-4828-a4a8-5237411f5455.aspx</guid>
      <link>http://www.distribucon.com/blog/BundlingForWebAssetsInASPNETMVC4.aspx</link>
      <pubDate>Wed, 29 Aug 2012 18:39:05 GMT</pubDate>
      <description>After installing the RTM version of VS2012 last week and upgrading my project, I noticed that my web site was broken. The real culprit seemed to be that Microsoft changed how bundling works (the process of combining and minifying resources like js script and css files) between the RC version and the RTM version. For an excellent background on what this feature can do for you, see &lt;a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification"&gt;this
tutorial&lt;/a&gt;. 
&lt;p /&gt;
It turns out my real problem was with Kendo. They don't provide non-minified files
in the trial version, so the new bundling mechanism wasn't including the minified
assets, which meant the Kendo minified assets were getting stripped out when I was
trying to run under debug. (&lt;a href="http://www.kendoui.com/forums/mvc/general-discussions/vs2012-rtm-mvc4-kendo-bundle-not-rendering.aspx"&gt;Reference
here&lt;/a&gt;). I was able to use the work-around offered on this thread, and things started
working again. 
&lt;p /&gt;
However, there are a few wrinkles when using the bundling code, so I thought I'd capture
my experiences here. For example: 
&lt;ul&gt;
&lt;li&gt;
For 3rd party components that don't ship with non-minified assets, you need a better
way around the default bundling strategy provided in the kendo article above. The
solution provided in that thread of removing the min files from the ignore list will
end up duplicating other assets that do provide both a minified and regular version
of their assets while running in debug mode, e.g. jquery. There is a workaround for
this, though: If you specify your bundle file's pattern with the {version} macro,
then the bundling framework is smart enough to include just the one copy of the asset.
If you use a wildcard in the pattern (as shown in the thread), you will get duplicate
min and non-min versions of the asset when you render. Here is what your code should
look like: &lt;pre&gt;&lt;code&gt; bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); &lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;
When specifying a CDN location, right now, you can't use the {version} macro, so you
end up with a hardcoded reference for your CDN link (1.7.1 in the sample) and a {version}
macro for the non-CDN reference (which could be 1.7.1, 1.7.2, or anything else that
exists in your solution). This means that when you update locally, you need to remember
to keep those version numbers in sync. The CDN path could take the version you have
locally and substitute it in the CDN path that you provide removing this requirement. 
&lt;li&gt;
In the tutorial, there is a fallback script that they recommend you write after your
Scripts.Render statement so you can gracefully fall back to the local version if the
CDN version doesn't load. It would be much better if that fallback code would be emitted
for you when you call Scripts.Render. 
&lt;li&gt;
Speaking of CDN, it appears that there is a very tight coupling assumed between a
bundle and a CDN path. In other words, you cannot include multiple assets in one bundle
because the CDN path for the bundle assumes it is a reference to a specific file on
the CDN. It would be better to have CDN paths be tied to each individual item in the
bundle. 
&lt;li&gt;
Also relating to CDN support: The CDN path will only be used if you set bundles.UseCDN
to true &lt;b&gt;AND&lt;/b&gt; you either have BundleTables.EnableOptimization set to true or
compilation debug set to false in your web.config. Granted, you probably only want
to use the CDN when you are pushing to production, but while trying to test things
out, I was doing it locally and this caught me by surprise. The 2 items should be
independent of each other. If not, why even bother having the UseCDN property? 
&lt;/ul&gt;
&lt;p /&gt;
It seems that there is quite a bit of friction in the current version of the bundling
framework. Fortunately, it resides in the Optimization assembly which can be upgraded
independently of the entire MVC framework. I hope Microsoft releases an update very
soon to overcome these obstacles. I have every reason to believe that they will since
I'm seeing &lt;a href="http://stackoverflow.com/users/1459890/hao-kung"&gt;the author of
this assembly&lt;/a&gt; answering tons of questions on StackOverflow. &lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=6270ff06-aca1-4828-a4a8-5237411f5455" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,6270ff06-aca1-4828-a4a8-5237411f5455.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=512ccbce-1b3c-46f1-9ab3-c48d7f81d33a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,512ccbce-1b3c-46f1-9ab3-c48d7f81d33a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,512ccbce-1b3c-46f1-9ab3-c48d7f81d33a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=512ccbce-1b3c-46f1-9ab3-c48d7f81d33a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I'm trying to settle on a standard for
a grid component for use in an ASP.NET MVC app. It looks like <a href="http://datatables.net">datatables.net</a> is
the winner for now. 
<p />
Here is my quick run-down on how to get it working: 
<ul><li>
Using NuGet, install Mvc.Jquery.Datatables 
</li><li>
Using NuGet, install EmbeddedVirtualPathProvider. 
</li><li>
In the generated App_Code\RegisterVirtualPathProvide.cs file, add the following line
where the comment tells you to. These last 2 steps are needed to get the grid to show
up on the page. <pre><code> {typeof(Mvc.JQuery.Datatables.DataTableVm).Assembly, @"..\Mvc.JQuery.Datatables"} </code></pre></li><li>
The sample found <a href="http://mvcjquerydatatables.apphb.com/">here</a> is a little
outdated and the instructions on the page don't match what's happening inside the
actual view. Use these instructions instead: 
<ul><li>
In the controller, you need to return a DataTablesResult (not an IDataTablesResult).
The assembly relies on finding an action with this return type, so that also means
that you can't redirect views, which isn't the worst thing since this should be an
AJAX request anyways. 
</li><li>
In the view, add this to the top (instead of the calls to the link and script tags
cited in the page: <pre><code> @Html.DataTableIncludes(jqueryUi:false) </code></pre></li><li>
In the view, the code should look similar to this where you want the grid (remember,
you need to have the controller action method return DataTablesResult in order for
this to work): <pre><code> @{ var vm = Html.DataTableVm("table-id", (DashboardController
h) =&gt; h.GetWireHistoryData(null)); } @Html.Partial("DataTable", vm) </code></pre></li></ul></li></ul><p />
There is a good series expanding on datatables usag in ASP.NET MVC <a href="http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part">over
at codeproject.com</a>. 
<p />
Thanks to Harry for the NuGet package. It definitely will make keeping things up to
date much easier.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=512ccbce-1b3c-46f1-9ab3-c48d7f81d33a" /></body>
      <title>jQuery DataTables in ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,512ccbce-1b3c-46f1-9ab3-c48d7f81d33a.aspx</guid>
      <link>http://www.distribucon.com/blog/jQueryDataTablesInASPNETMVC.aspx</link>
      <pubDate>Mon, 30 Jul 2012 19:46:19 GMT</pubDate>
      <description>I'm trying to settle on a standard for a grid component for use in an ASP.NET MVC app. It looks like &lt;a href="http://datatables.net"&gt;datatables.net&lt;/a&gt; is
the winner for now. 
&lt;p /&gt;
Here is my quick run-down on how to get it working: 
&lt;ul&gt;
&lt;li&gt;
Using NuGet, install Mvc.Jquery.Datatables 
&lt;li&gt;
Using NuGet, install EmbeddedVirtualPathProvider. 
&lt;li&gt;
In the generated App_Code\RegisterVirtualPathProvide.cs file, add the following line
where the comment tells you to. These last 2 steps are needed to get the grid to show
up on the page. &lt;pre&gt;&lt;code&gt; {typeof(Mvc.JQuery.Datatables.DataTableVm).Assembly, @"..\Mvc.JQuery.Datatables"} &lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;
The sample found &lt;a href="http://mvcjquerydatatables.apphb.com/"&gt;here&lt;/a&gt; is a little
outdated and the instructions on the page don't match what's happening inside the
actual view. Use these instructions instead: 
&lt;ul&gt;
&lt;li&gt;
In the controller, you need to return a DataTablesResult (not an IDataTablesResult).
The assembly relies on finding an action with this return type, so that also means
that you can't redirect views, which isn't the worst thing since this should be an
AJAX request anyways. 
&lt;li&gt;
In the view, add this to the top (instead of the calls to the link and script tags
cited in the page: &lt;pre&gt;&lt;code&gt; @Html.DataTableIncludes(jqueryUi:false) &lt;/code&gt;&lt;/pre&gt;
&lt;li&gt;
In the view, the code should look similar to this where you want the grid (remember,
you need to have the controller action method return DataTablesResult in order for
this to work): &lt;pre&gt;&lt;code&gt; @{ var vm = Html.DataTableVm("table-id", (DashboardController
h) =&gt; h.GetWireHistoryData(null)); } @Html.Partial("DataTable", vm) &lt;/code&gt;&lt;/pre&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p /&gt;
There is a good series expanding on datatables usag in ASP.NET MVC &lt;a href="http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part"&gt;over
at codeproject.com&lt;/a&gt;. 
&lt;p /&gt;
Thanks to Harry for the NuGet package. It definitely will make keeping things up to
date much easier.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=512ccbce-1b3c-46f1-9ab3-c48d7f81d33a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,512ccbce-1b3c-46f1-9ab3-c48d7f81d33a.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=fa79bcb4-b95f-41f1-9a61-12d946935a42</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,fa79bcb4-b95f-41f1-9a61-12d946935a42.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,fa79bcb4-b95f-41f1-9a61-12d946935a42.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=fa79bcb4-b95f-41f1-9a61-12d946935a42</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I have an HTML form that allows users to
fill out a bunch of different parameters, and then it will display the result on the
same page via an AJAX call. Pretty standard, and it works great. I had a request to
allow for exporting the data in Excel format. Unfortunately, just returning a File
ActionResult won't work from within the context of an Ajax form. There were some workaround
posted out there (e.g. hidden iframe, duplicate the form on the page, etc.). I found
the following approach to be a nice compromise and DRYs things up considerably. The
key is that by putting the onclick on the Export button to do this.form.submit(),
it forces the request to be a standard POST and not an AJAX call. 
<p><b>View.cshtml</b></p><pre><code> @using(Ajax.BeginForm("ReportData", new AjaxOptions {UpdateTargetId="result"}))
{ ... other input elements here &lt;input type="submit" value="Display" /&gt; &lt;input
type="submit" value="Export" onclick="this.form.submit();"&gt; } </code></pre><p><b>Controller.cs</b></p><pre><code> public ActionResult ReportData(... parameters go here ...) { if (Request.IsAjaxRequest())
{ // Do the normal behavior here to build up a string return Content(s); } // I actually
stream the result with a custom ExcelResult action, // but this shows how to just
return a file. return File(@"c:\library\report.xls", "application/vnd.ms-excel");
} </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=fa79bcb4-b95f-41f1-9a61-12d946935a42" /></body>
      <title>Downloading from within an AJAX form</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,fa79bcb4-b95f-41f1-9a61-12d946935a42.aspx</guid>
      <link>http://www.distribucon.com/blog/DownloadingFromWithinAnAJAXForm.aspx</link>
      <pubDate>Sun, 19 Feb 2012 17:33:35 GMT</pubDate>
      <description>I have an HTML form that allows users to fill out a bunch of different parameters, and then it will display the result on the same page via an AJAX call. Pretty standard, and it works great. I had a request to allow for exporting the data in Excel format. Unfortunately, just returning a File ActionResult won't work from within the context of an Ajax form. There were some workaround posted out there (e.g. hidden iframe, duplicate the form on the page, etc.). I found the following approach to be a nice compromise and DRYs things up considerably. The key is that by putting the onclick on the Export button to do this.form.submit(), it forces the request to be a standard POST and not an AJAX call.
&lt;p&gt;
&lt;b&gt;View.cshtml&lt;/b&gt; 
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; @using(Ajax.BeginForm("ReportData", new AjaxOptions {UpdateTargetId="result"}))
{ ... other input elements here &amp;lt;input type="submit" value="Display" /&amp;gt; &amp;lt;input
type="submit" value="Export" onclick="this.form.submit();"&amp;gt; } &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;b&gt;Controller.cs&lt;/b&gt; 
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; public ActionResult ReportData(... parameters go here ...) { if (Request.IsAjaxRequest())
{ // Do the normal behavior here to build up a string return Content(s); } // I actually
stream the result with a custom ExcelResult action, // but this shows how to just
return a file. return File(@"c:\library\report.xls", "application/vnd.ms-excel");
} &lt;/code&gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=fa79bcb4-b95f-41f1-9a61-12d946935a42" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,fa79bcb4-b95f-41f1-9a61-12d946935a42.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c0caa2c1-d573-42bf-bf12-62b574d72463</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c0caa2c1-d573-42bf-bf12-62b574d72463.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c0caa2c1-d573-42bf-bf12-62b574d72463.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c0caa2c1-d573-42bf-bf12-62b574d72463</wfw:commentRss>
      <title>The Award For Most Useless Overloaded Method Ever Goes To...</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c0caa2c1-d573-42bf-bf12-62b574d72463.aspx</guid>
      <link>http://www.distribucon.com/blog/TheAwardForMostUselessOverloadedMethodEverGoesTo.aspx</link>
      <pubDate>Sun, 15 Jan 2012 15:52:59 GMT</pubDate>
      <description>What's the difference between these 2 methods?
&lt;pre&gt;&lt;code&gt;&lt;string, objection&gt; Html.ActionLink(string
linkText, string actionName, object routeValues, object htmlAttributes) Html.ActionLink(string
linkText, string actionName, RouteValueDictionary routeValues, IDictionary htmlAttributes) &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
Yes, they have the same number of parameters. Yes, they even have the same parameter
names. So in essence the intent of calling either of these methods is to build up
a link with the passed in route values and HTML attributes. Yet the difference between
these 2 methods couldn't be more pronounced. 
&lt;p /&gt;
Take this line of code: &lt;pre&gt;&lt;code&gt; @Html.ActionLink("Back to List", "Index", TempData["SavedRouteValues"],
null) &lt;/code&gt;&lt;/pre&gt;
What I wanted was an easy way to retain the settings of a Telerik ASP.NET MVC Grid
and build up a link to bring me back to the correct state. This line of code does
that. However, it generates a link similar to this (word-wrapped here for clarity): &lt;pre&gt;&lt;code&gt; http://www.foo.com/Grid?Count=3&amp;Keys=System.Collections.Generic.Dictionary%602%2BKeyCollection%5BSystem.String%2CSystem.Object
%5D&amp;Values=System.Collections.Generic.Dictionary%602%2BValueCollection%5BSystem.String%2CSystem.Object%5D &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
Brutal. Ugly. 
&lt;p /&gt;
To fix this, just use this code (a simple typecast) to force the correct overloaded
method to be picked: &lt;pre&gt;&lt;code&gt; @Html.ActionLink("Back to List", "Index", (RouteValueDictionary)TempData["SavedRouteValues"],
null) &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The moral of the story? If you're an API desiger, don't make overloaded methods lightly.
Make sure they add value and distinction. A strong type vs. an object reference doesn't
pass that test. If you do violate that rule, however, then at least be sure that the
overload fulfills the intent and implied contract of that method.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c0caa2c1-d573-42bf-bf12-62b574d72463" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c0caa2c1-d573-42bf-bf12-62b574d72463.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=7d56fa21-a0c2-49d9-aaa6-f801f572c403</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,7d56fa21-a0c2-49d9-aaa6-f801f572c403.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,7d56fa21-a0c2-49d9-aaa6-f801f572c403.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7d56fa21-a0c2-49d9-aaa6-f801f572c403</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I've had a web application written <a href="http://www.distribucon.com/blog/ASPNETMVCOnTheIPhone.aspx">using
iUI</a> for a couple of years now. It's been stable and rock solid, and I really appreciate
the leg up that it gave me. However, this weekend I converted away from iUI to <a href="http://www.jquerymobile.com">jQueryMobile</a>.
I have another application in production already using jQueryMobile, and it is absolutely
an amazing library.<br /><br />
The reasons I went with this move were:<br /><ul><li>
iOS 5 had substantial changes to Safari and my existing application is broken in many
places. Instead of spending time debugging and fixing something 2 years old, I figured
I'd take the time to port to jQueryMobile.<br /></li><li>
I've had to leave iUI at version 0.31 for this entire 2 year period. When they started
development on the 0.4 version, they changed form submissions to break if you had
multiple form fields with the same name. I absolutely had to have this capability
in order to support <a href="http://www.distribucon.com/blog/ASPNETMVCOnTheIPhone.aspx">ASP.NET
MVC list binding</a>. I reported the issue in the forums, and it didn't get much attention.
Sure, it's open source, but if I have to chase down bug fixing in a framework I'm
not intimately familiar with, it's a negative.<br /></li><li>
There is no easy way with the released version of iUI to do things like jQuery calls,
hook events into the page create/show and hide/destroy. Sure, there are code modifications
you can find on the web, but it's a forking nightmare and tough to maintain (is this
for 0.31, 0.4, or 0.5? does it require other extensions or modifications? etc.).<br /></li><li>
From a non-technical perspective, the roadmap of iUI has been all over the place.
I can't remember for sure, but I think it was originally slated for moving 0.4 in
to release status in like June of 2009. It's been pushed out over and over again,
trimmed in scope, and there just doesn't seem to be traction or consensus to move
the product forward. In contrast, jQueryMobile is looking to have a 1.0 release in
the next few weeks with constant releases over the past few months.<br /></li></ul><p></p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7d56fa21-a0c2-49d9-aaa6-f801f572c403" /></body>
      <title>Replacing iUI with JQueryMobile</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,7d56fa21-a0c2-49d9-aaa6-f801f572c403.aspx</guid>
      <link>http://www.distribucon.com/blog/ReplacingIUIWithJQueryMobile.aspx</link>
      <pubDate>Sat, 15 Oct 2011 21:26:06 GMT</pubDate>
      <description>I've had a web application written &lt;a href="http://www.distribucon.com/blog/ASPNETMVCOnTheIPhone.aspx"&gt;using
iUI&lt;/a&gt; for a couple of years now. It's been stable and rock solid, and I really appreciate
the leg up that it gave me. However, this weekend I converted away from iUI to &lt;a href="http://www.jquerymobile.com"&gt;jQueryMobile&lt;/a&gt;.
I have another application in production already using jQueryMobile, and it is absolutely
an amazing library.&lt;br&gt;
&lt;br&gt;
The reasons I went with this move were:&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;
iOS 5 had substantial changes to Safari and my existing application is broken in many
places. Instead of spending time debugging and fixing something 2 years old, I figured
I'd take the time to port to jQueryMobile.&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
I've had to leave iUI at version 0.31 for this entire 2 year period. When they started
development on the 0.4 version, they changed form submissions to break if you had
multiple form fields with the same name. I absolutely had to have this capability
in order to support &lt;a href="http://www.distribucon.com/blog/ASPNETMVCOnTheIPhone.aspx"&gt;ASP.NET
MVC list binding&lt;/a&gt;. I reported the issue in the forums, and it didn't get much attention.
Sure, it's open source, but if I have to chase down bug fixing in a framework I'm
not intimately familiar with, it's a negative.&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
There is no easy way with the released version of iUI to do things like jQuery calls,
hook events into the page create/show and hide/destroy. Sure, there are code modifications
you can find on the web, but it's a forking nightmare and tough to maintain (is this
for 0.31, 0.4, or 0.5? does it require other extensions or modifications? etc.).&lt;br&gt;
&lt;/li&gt;
&lt;li&gt;
From a non-technical perspective, the roadmap of iUI has been all over the place.
I can't remember for sure, but I think it was originally slated for moving 0.4 in
to release status in like June of 2009. It's been pushed out over and over again,
trimmed in scope, and there just doesn't seem to be traction or consensus to move
the product forward. In contrast, jQueryMobile is looking to have a 1.0 release in
the next few weeks with constant releases over the past few months.&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7d56fa21-a0c2-49d9-aaa6-f801f572c403" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,7d56fa21-a0c2-49d9-aaa6-f801f572c403.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
      <category>iPhone</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=ca79a99e-c698-4e0c-9449-f9d79fdff1f0</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,ca79a99e-c698-4e0c-9449-f9d79fdff1f0.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,ca79a99e-c698-4e0c-9449-f9d79fdff1f0.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ca79a99e-c698-4e0c-9449-f9d79fdff1f0</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">While creating a view model for an MVC
3 application, I annotated a property with the DataType.EmailAddress attribute. My
thinking was that it would validate whether or not the contents of the property was
in a valid email format. The attribute does not perform validation, however. This <a href="http://stackoverflow.com/questions/2391423/is-the-datatypeattribute-validation-working-in-mvc2">StackOverflow</a> article
discusses some ways to add that functionality.<br /><p></p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ca79a99e-c698-4e0c-9449-f9d79fdff1f0" /></body>
      <title>DataType.EmailAddress doesn't validate</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,ca79a99e-c698-4e0c-9449-f9d79fdff1f0.aspx</guid>
      <link>http://www.distribucon.com/blog/DataTypeEmailAddressDoesntValidate.aspx</link>
      <pubDate>Thu, 01 Sep 2011 02:31:51 GMT</pubDate>
      <description>While creating a view model for an MVC 3 application, I annotated a property with the DataType.EmailAddress attribute. My thinking was that it would validate whether or not the contents of the property was in a valid email format. The attribute does not perform validation, however. This &lt;a href="http://stackoverflow.com/questions/2391423/is-the-datatypeattribute-validation-working-in-mvc2"&gt;StackOverflow&lt;/a&gt; article
discusses some ways to add that functionality.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ca79a99e-c698-4e0c-9449-f9d79fdff1f0" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,ca79a99e-c698-4e0c-9449-f9d79fdff1f0.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=56424993-6c09-408c-a425-b5f4fefb0db8</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,56424993-6c09-408c-a425-b5f4fefb0db8.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,56424993-6c09-408c-a425-b5f4fefb0db8.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=56424993-6c09-408c-a425-b5f4fefb0db8</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been ussing <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">CC.NET</a> for
probably the last 5 years with good success. At work, we recently migrated to TFS
2010 (installation and configuration are brutal, but it's sort of nice when it all
works). I figured I'd take this time to look around and see what I've been missing
on the continuous integration scene for my personal projects. The 2 leading contenders
were <a href="http://www.jetbrains.com/teamcity">TeamCity</a> and <a href="http://www.atlassian.com/software/bamboo/">Bamboo</a>.
I went with TeamCity since I use ReSharper, and think the JetBrains guys are pretty
top-notch.<br /><br />
Installation was drop-dead simple. Configuring was pretty straight-forward, but I
had an assist from <a href="http://stackoverflow.com/questions/361386/thorough-tutorial-on-setting-up-jetbrains-teamcity-ci-server">StackOverflow</a>,
which led me to this amazing article/series by <a href="http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity_25.html">Troy
Hunt</a>. After following Troy's instructions, and slightly adjusting for the obvious
version differences, I had things up and running, with a completed build inside 15
minutes.<br /><br />
I also configured the Build Triggering step because I want the build to fire off each
time I checkin. I've got a few things to take care of (notifications of broken builds,
code coverage, etc.), but it looks like this is a much easier application to configure
than CC.NET.<br /><p></p><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=56424993-6c09-408c-a425-b5f4fefb0db8" /></body>
      <title>TeamCity for Continuous Integration of .NET projects</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,56424993-6c09-408c-a425-b5f4fefb0db8.aspx</guid>
      <link>http://www.distribucon.com/blog/TeamCityForContinuousIntegrationOfNETProjects.aspx</link>
      <pubDate>Sun, 17 Jul 2011 01:36:26 GMT</pubDate>
      <description>I've been ussing &lt;a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET"&gt;CC.NET&lt;/a&gt; for
probably the last 5 years with good success. At work, we recently migrated to TFS
2010 (installation and configuration are brutal, but it's sort of nice when it all
works). I figured I'd take this time to look around and see what I've been missing
on the continuous integration scene for my personal projects. The 2 leading contenders
were &lt;a href="http://www.jetbrains.com/teamcity"&gt;TeamCity&lt;/a&gt; and &lt;a href="http://www.atlassian.com/software/bamboo/"&gt;Bamboo&lt;/a&gt;.
I went with TeamCity since I use ReSharper, and think the JetBrains guys are pretty
top-notch.&lt;br&gt;
&lt;br&gt;
Installation was drop-dead simple. Configuring was pretty straight-forward, but I
had an assist from &lt;a href="http://stackoverflow.com/questions/361386/thorough-tutorial-on-setting-up-jetbrains-teamcity-ci-server"&gt;StackOverflow&lt;/a&gt;,
which led me to this amazing article/series by &lt;a href="http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity_25.html"&gt;Troy
Hunt&lt;/a&gt;. After following Troy's instructions, and slightly adjusting for the obvious
version differences, I had things up and running, with a completed build inside 15
minutes.&lt;br&gt;
&lt;br&gt;
I also configured the Build Triggering step because I want the build to fire off each
time I checkin. I've got a few things to take care of (notifications of broken builds,
code coverage, etc.), but it looks like this is a much easier application to configure
than CC.NET.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=56424993-6c09-408c-a425-b5f4fefb0db8" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,56424993-6c09-408c-a425-b5f4fefb0db8.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=a853238f-b138-4683-a4a7-0f4dae1464eb</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,a853238f-b138-4683-a4a7-0f4dae1464eb.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,a853238f-b138-4683-a4a7-0f4dae1464eb.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a853238f-b138-4683-a4a7-0f4dae1464eb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I needed to allow a user the ability to select multiple items in a list and select
them. A simple multiselect listbox was not going to suffice, given the number of items
in the list. I started searching to see what was out there as a jQuery plugin or control.
The search was pretty frustrating. There were a couple out there that have apparently
been abandoned, and several that just didn’t meet my needs. I will say that the coolest
one that I found that didn’t meet my needs was from <a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/" target="_blank">Eric
Hynds</a>. It was really well done, but I didn’t want the combobox type metaphor with
checkboxes. I wanted the lists to display with more real estate to make things more
obvious.
</p>
        <p>
I finally found <a href="http://www.quasipartikel.at/multiselect/" target="_blank">jQuery
UI Multiselect</a>. 
</p>
        <p>
          <a href="http://www.distribucon.com/blog/content/binary/Windows-Live-Writer/aaab5f32a421_942A/jquerymultiselect_2.png">
            <img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jquerymultiselect" border="0" alt="jquerymultiselect" src="http://www.distribucon.com/blog/content/binary/Windows-Live-Writer/aaab5f32a421_942A/jquerymultiselect_thumb.png" width="414" height="142" />
          </a>
        </p>
        <p>
The problem is, it wasn’t immediately obvious what to download. The link I just referenced
says it supports jQuery 1.5 and jQuery UI 1.8. But if you go to <a href="http://github.com/michael/multiselect" target="_blank">github</a>,
things get a bit confusing. The README says the repository isn’t actively maintained
anymore. Further complicating things is that the original page above points to a broken
github link as the replacement. The README file on github points to the <a href="https://github.com/michael/multiselect/tree/next" target="_blank">latest
version</a>, though.
</p>
        <p>
The problem then becomes that the file dates on the newer branch are older than the
unmaintained branch! Also troubling is that the <a href="http://quasipartikel.at/multiselect_next/" target="_blank">link
to the demo page</a> on this README says it supports jQuery 1.4.2 and jQuery 1.8,
which is older than the unmaintained version. You also need to be sure to download
the <strong>source</strong> from the Download link on github, and not the packages.
It looks like the “next” branch will work, but I’ve had to fix like 3 or 4 things
in that version to get it to work the way I would expect it to. I’ll bundle those
changes up and submit a pull request.
</p>
        <p>
Long story short, I would recommend using <a href="http://github.com/michael/multiselect/zipball/next" target="_blank">this
download link</a> and get at least version 0.3-27.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a853238f-b138-4683-a4a7-0f4dae1464eb" />
      </body>
      <title>jQuery Multiselect</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,a853238f-b138-4683-a4a7-0f4dae1464eb.aspx</guid>
      <link>http://www.distribucon.com/blog/jQueryMultiselect.aspx</link>
      <pubDate>Wed, 25 May 2011 15:55:25 GMT</pubDate>
      <description>&lt;p&gt;
I needed to allow a user the ability to select multiple items in a list and select
them. A simple multiselect listbox was not going to suffice, given the number of items
in the list. I started searching to see what was out there as a jQuery plugin or control.
The search was pretty frustrating. There were a couple out there that have apparently
been abandoned, and several that just didn’t meet my needs. I will say that the coolest
one that I found that didn’t meet my needs was from &lt;a href="http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/" target="_blank"&gt;Eric
Hynds&lt;/a&gt;. It was really well done, but I didn’t want the combobox type metaphor with
checkboxes. I wanted the lists to display with more real estate to make things more
obvious.
&lt;/p&gt;
&lt;p&gt;
I finally found &lt;a href="http://www.quasipartikel.at/multiselect/" target="_blank"&gt;jQuery
UI Multiselect&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.distribucon.com/blog/content/binary/Windows-Live-Writer/aaab5f32a421_942A/jquerymultiselect_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="jquerymultiselect" border="0" alt="jquerymultiselect" src="http://www.distribucon.com/blog/content/binary/Windows-Live-Writer/aaab5f32a421_942A/jquerymultiselect_thumb.png" width="414" height="142"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The problem is, it wasn’t immediately obvious what to download. The link I just referenced
says it supports jQuery 1.5 and jQuery UI 1.8. But if you go to &lt;a href="http://github.com/michael/multiselect" target="_blank"&gt;github&lt;/a&gt;,
things get a bit confusing. The README says the repository isn’t actively maintained
anymore. Further complicating things is that the original page above points to a broken
github link as the replacement. The README file on github points to the &lt;a href="https://github.com/michael/multiselect/tree/next" target="_blank"&gt;latest
version&lt;/a&gt;, though.
&lt;/p&gt;
&lt;p&gt;
The problem then becomes that the file dates on the newer branch are older than the
unmaintained branch! Also troubling is that the &lt;a href="http://quasipartikel.at/multiselect_next/" target="_blank"&gt;link
to the demo page&lt;/a&gt; on this README says it supports jQuery 1.4.2 and jQuery 1.8,
which is older than the unmaintained version. You also need to be sure to download
the &lt;strong&gt;source&lt;/strong&gt; from the Download link on github, and not the packages.
It looks like the “next” branch will work, but I’ve had to fix like 3 or 4 things
in that version to get it to work the way I would expect it to. I’ll bundle those
changes up and submit a pull request.
&lt;/p&gt;
&lt;p&gt;
Long story short, I would recommend using &lt;a href="http://github.com/michael/multiselect/zipball/next" target="_blank"&gt;this
download link&lt;/a&gt; and get at least version 0.3-27.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a853238f-b138-4683-a4a7-0f4dae1464eb" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,a853238f-b138-4683-a4a7-0f4dae1464eb.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=9956c34d-db21-49cd-9848-9acfe04e6901</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,9956c34d-db21-49cd-9848-9acfe04e6901.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,9956c34d-db21-49cd-9848-9acfe04e6901.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9956c34d-db21-49cd-9848-9acfe04e6901</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In ASP.NET WebForms, the following code snippet will render just fine, no matter where
it is in the page: 
</p>
        <pre>
          <code> &lt;% if (!string.IsNullOrEmpty(machine.SerialNumber)) { %&gt; Response.Write("("
+ machine.SerialNumber + ")"; &lt;%}%&gt; </code>
        </pre>
        <p>
However, if you just convert that over to Razor, the Response.Write call will execute
before the rest of the page gets executed, resulting in the data in Response.Write
to be rendered before any part of the page. The correct translation should be: 
</p>
        <pre>
          <code> if (!string.IsNullOrEmpty(machine.SerialNumber)) { &lt;text&gt;(@machine.SerialNumber)&lt;/text&gt;
} </code>
        </pre>
        <p>
If your Response.Write isn't buried in an if statement, then it's even easier, as
you won't even need a &lt;text&gt; block due to the code/markup parsing that Razor
does! 
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=9956c34d-db21-49cd-9848-9acfe04e6901" />
      </body>
      <title>Razor and Response.Write</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,9956c34d-db21-49cd-9848-9acfe04e6901.aspx</guid>
      <link>http://www.distribucon.com/blog/RazorAndResponseWrite.aspx</link>
      <pubDate>Fri, 20 May 2011 05:15:10 GMT</pubDate>
      <description>&lt;p&gt;
In ASP.NET WebForms, the following code snippet will render just fine, no matter where
it is in the page: &lt;pre&gt;&lt;code&gt; &amp;lt;% if (!string.IsNullOrEmpty(machine.SerialNumber))
{ %&amp;gt; Response.Write("(" + machine.SerialNumber + ")"; &amp;lt;%}%&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&gt;
&lt;p&gt;
However, if you just convert that over to Razor, the Response.Write call will execute
before the rest of the page gets executed, resulting in the data in Response.Write
to be rendered before any part of the page. The correct translation should be: &lt;pre&gt;&lt;code&gt; if
(!string.IsNullOrEmpty(machine.SerialNumber)) { &amp;lt;text&amp;gt;(@machine.SerialNumber)&amp;lt;/text&amp;gt;
} &lt;/code&gt;&lt;/pre&gt;
&gt;
&lt;p&gt;
If your Response.Write isn't buried in an if statement, then it's even easier, as
you won't even need a &amp;lt;text&amp;gt; block due to the code/markup parsing that Razor
does! 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=9956c34d-db21-49cd-9848-9acfe04e6901" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,9956c34d-db21-49cd-9848-9acfe04e6901.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=3106007f-51be-47a7-93ed-650d1ee8f13a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,3106007f-51be-47a7-93ed-650d1ee8f13a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,3106007f-51be-47a7-93ed-650d1ee8f13a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3106007f-51be-47a7-93ed-650d1ee8f13a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For an ASP.NET MVC application, consider the following code fragment, where GetDetails
will return HTML markup:
</p>
        <pre>
          <code> &lt;%using (Ajax.BeginForm("GetDetails", new AjaxOptions { UpdateTargetId
= "result" })) { %&gt; &lt;input type="submit" /&gt; &lt;% } %&gt; &lt;span id="result"
/&gt; </code>
        </pre>
        <p />
This code works beautifully in Firefox and Chrome, but in IE (at least 7 and 8), it
ends up chewing up parts of the master page, wreaking havoc on the layout of the rendered
page. The problem is that the span tag is a void element (it only has a start tag).
If you physically specify the span as a start and end tag, e.g. <code>&lt;span id="result"&gt;&lt;/span&gt;</code>,
then the code will work fine in all 3 browsers. 
<p />
I was tempted to blame IE, and I still sort of do, but at least they're handling the
HTML spec properly. w3.org clearly specifies that <a href="http://www.w3.org/TR/html-markup/syntax.html" target="_blank">the
span tag is not allowed to be a void element</a> (search within the page for "void
element" to see the list of allowed void elements), and it's consistent on the <a href="http://www.w3.org/TR/html-markup/span.html#span" target="_blank">span
reference page</a>. The reason I still sort of blame IE is: 
<ol><li>
Mozilla and Chrome understand that a void span element can be expanded in to start
and end tags</li><li>
A void span element works just fine if it's enclosed in another HTML element, e.g. <code>&lt;td&gt;&lt;span
id="result" /&gt;&lt;/td&gt;</code> will display the returned HTML just fine</li><li>
When looking at the rendered page with IE Developer Tools, if a void span element
is encountered in a content page, they go back to the master page and stuff the rest
of the master page in the span. I guess they're free to implement malformed HTML anyway
they like, but this just seems crazy.</li></ol><p />
The takeaway: All of this due to a missing end tag for a span. Ugh!<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3106007f-51be-47a7-93ed-650d1ee8f13a" /></body>
      <title>SPAN tags in IE require end tags</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,3106007f-51be-47a7-93ed-650d1ee8f13a.aspx</guid>
      <link>http://www.distribucon.com/blog/SPANTagsInIERequireEndTags.aspx</link>
      <pubDate>Wed, 02 Feb 2011 02:49:29 GMT</pubDate>
      <description>&lt;p&gt;
For an ASP.NET MVC application, consider the following code fragment, where GetDetails
will return HTML markup:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;%using (Ajax.BeginForm("GetDetails", new AjaxOptions { UpdateTargetId
= "result" })) { %&amp;gt; &amp;lt;input type="submit" /&amp;gt; &amp;lt;% } %&amp;gt; &amp;lt;span id="result"
/&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
This code works beautifully in Firefox and Chrome, but in IE (at least 7 and 8), it
ends up chewing up parts of the master page, wreaking havoc on the layout of the rendered
page. The problem is that the span tag is a void element (it only has a start tag).
If you physically specify the span as a start and end tag, e.g. &lt;code&gt;&amp;lt;span id="result"&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt;,
then the code will work fine in all 3 browsers. 
&lt;p /&gt;
I was tempted to blame IE, and I still sort of do, but at least they're handling the
HTML spec properly. w3.org clearly specifies that &lt;a href="http://www.w3.org/TR/html-markup/syntax.html" target="_blank"&gt;the
span tag is not allowed to be a void element&lt;/a&gt; (search within the page for "void
element" to see the list of allowed void elements), and it's consistent on the &lt;a href="http://www.w3.org/TR/html-markup/span.html#span" target="_blank"&gt;span
reference page&lt;/a&gt;. The reason I still sort of blame IE is: 
&lt;ol&gt;
&lt;li&gt;
Mozilla and Chrome understand that a void span element can be expanded in to start
and end tags&lt;/li&gt;
&lt;li&gt;
A void span element works just fine if it's enclosed in another HTML element, e.g. &lt;code&gt;&amp;lt;td&amp;gt;&amp;lt;span
id="result" /&amp;gt;&amp;lt;/td&amp;gt;&lt;/code&gt; will display the returned HTML just fine&lt;/li&gt;
&lt;li&gt;
When looking at the rendered page with IE Developer Tools, if a void span element
is encountered in a content page, they go back to the master page and stuff the rest
of the master page in the span. I guess they're free to implement malformed HTML anyway
they like, but this just seems crazy.&lt;/li&gt;
&lt;/ol&gt;
&lt;p /&gt;
The takeaway: All of this due to a missing end tag for a span. Ugh!&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=3106007f-51be-47a7-93ed-650d1ee8f13a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,3106007f-51be-47a7-93ed-650d1ee8f13a.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=e9083bab-855a-4e49-9732-f0fa210c31e9</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,e9083bab-855a-4e49-9732-f0fa210c31e9.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,e9083bab-855a-4e49-9732-f0fa210c31e9.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e9083bab-855a-4e49-9732-f0fa210c31e9</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Rather than another "me too" post on the
release of ASP.NET MVC 3, which Hanselman, Haack, and Guthrie have covered in-depth,
I thought I'd post the good news that a couple of bugs that have bothered me are fixed
in this version. 
<p /><ol><li>
There was a problem when using <a href="http://www.hanselman.com/blog/ABetterASPNETMVCMobileDeviceCapabilitiesViewEngine.aspx" target="_new">auto-detecting
view engines</a> when compiling under release mode. Basically, if you hit the site
with your desktop browser first, and then come in with the mobile phone, you would
still be presented the desktop version. This is now fixed. 
</li><li>
I posted about <a href="http://www.distribucon.com/blog/ASPNETMVC3RC2BindingErrors.aspx" target="_new">a
problem with binding with the RC2 release</a>. This also appears to be fixed. 
</li></ol>
Throw in the <a href="http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/" target="_new">new
scaffolding support</a>, and 2011 is shaping up to be a great year for MVC.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e9083bab-855a-4e49-9732-f0fa210c31e9" /></body>
      <title>ASP.NET MVC 3 RTM bug fixes</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,e9083bab-855a-4e49-9732-f0fa210c31e9.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVC3RTMBugFixes.aspx</link>
      <pubDate>Sat, 15 Jan 2011 07:25:35 GMT</pubDate>
      <description>Rather than another "me too" post on the release of ASP.NET MVC 3, which Hanselman, Haack, and Guthrie have covered in-depth, I thought I'd post the good news that a couple of bugs that have bothered me are fixed in this version.
&lt;p /&gt;
&lt;ol&gt;
&lt;li&gt;
There was a problem when using &lt;a href="http://www.hanselman.com/blog/ABetterASPNETMVCMobileDeviceCapabilitiesViewEngine.aspx" target="_new"&gt;auto-detecting
view engines&lt;/a&gt; when compiling under release mode. Basically, if you hit the site
with your desktop browser first, and then come in with the mobile phone, you would
still be presented the desktop version. This is now fixed. 
&lt;li&gt;
I posted about &lt;a href="http://www.distribucon.com/blog/ASPNETMVC3RC2BindingErrors.aspx" target="_new"&gt;a
problem with binding with the RC2 release&lt;/a&gt;. This also appears to be fixed. 
&lt;/ol&gt;
Throw in the &lt;a href="http://blog.stevensanderson.com/2011/01/13/scaffold-your-aspnet-mvc-3-project-with-the-mvcscaffolding-package/" target="_new"&gt;new
scaffolding support&lt;/a&gt;, and 2011 is shaping up to be a great year for MVC.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e9083bab-855a-4e49-9732-f0fa210c31e9" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,e9083bab-855a-4e49-9732-f0fa210c31e9.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=81cc9649-a428-48de-832c-05c6296c6cf1</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,81cc9649-a428-48de-832c-05c6296c6cf1.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,81cc9649-a428-48de-832c-05c6296c6cf1.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=81cc9649-a428-48de-832c-05c6296c6cf1</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I recently moved away from shared hosting,
and went to a virtual private server in order to scale a site out better. Unfortunately,
this meant that I needed to take on more administration of the server to do things
that are done for me in a shared hosting environment. One feature that I have come
to rely on is one click publishing from VS.NET 2010. In order to make this work, you
need to have <a href="http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx" target="_blank">WebDeploy</a> set
up properly. 
<p />
I found the steps from <a href="http://technet.microsoft.com/en-us/library/dd722796%28WS.10%29.aspx" target="_blank">this
page</a> to be very helpful. Another good guide can be found <a href="http://blog.salvoz.com/CommentView,guid,50c5ad5a-ce84-4c7b-aab3-63b22b1af93d.aspx#commentstart" target="_blank">here</a>. 
<p />
Be careful if you install Web Deploy via the Web Platform Installer. For some reason,
when I did this, the Management Service Delegation feature was not installed. I ended
up uninstalling and then installing straight from <a href="http://www.iis.net/download/WebDeploy" target="_blank">the
official site</a>, and the feature was available. 
<p />
I initially had some settings wrong, and was getting back HTTP 401 and 550 errors.
The log files didn't provide much help, but you can <a href="http://technet.microsoft.com/en-us/library/ff729437%28WS.10%29.aspx" target="_blank">add
tracing</a> to help diagnose the cause of most issues. <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=81cc9649-a428-48de-832c-05c6296c6cf1" /></body>
      <title>WebDeploy setup</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,81cc9649-a428-48de-832c-05c6296c6cf1.aspx</guid>
      <link>http://www.distribucon.com/blog/WebDeploySetup.aspx</link>
      <pubDate>Mon, 03 Jan 2011 16:12:24 GMT</pubDate>
      <description>I recently moved away from shared hosting, and went to a virtual private server in order to scale a site out better. Unfortunately, this meant that I needed to take on more administration of the server to do things that are done for me in a shared hosting environment. One feature that I have come to rely on is one click publishing from VS.NET 2010. In order to make this work, you need to have &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx" target="_blank"&gt;WebDeploy&lt;/a&gt; set
up properly. 
&lt;p /&gt;
I found the steps from &lt;a href="http://technet.microsoft.com/en-us/library/dd722796%28WS.10%29.aspx" target="_blank"&gt;this
page&lt;/a&gt; to be very helpful. Another good guide can be found &lt;a href="http://blog.salvoz.com/CommentView,guid,50c5ad5a-ce84-4c7b-aab3-63b22b1af93d.aspx#commentstart" target="_blank"&gt;here&lt;/a&gt;. 
&lt;p /&gt;
Be careful if you install Web Deploy via the Web Platform Installer. For some reason,
when I did this, the Management Service Delegation feature was not installed. I ended
up uninstalling and then installing straight from &lt;a href="http://www.iis.net/download/WebDeploy" target="_blank"&gt;the
official site&lt;/a&gt;, and the feature was available. 
&lt;p /&gt;
I initially had some settings wrong, and was getting back HTTP 401 and 550 errors.
The log files didn't provide much help, but you can &lt;a href="http://technet.microsoft.com/en-us/library/ff729437%28WS.10%29.aspx" target="_blank"&gt;add
tracing&lt;/a&gt; to help diagnose the cause of most issues. &lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=81cc9649-a428-48de-832c-05c6296c6cf1" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,81cc9649-a428-48de-832c-05c6296c6cf1.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=8ac37562-148c-40cc-aa39-ba8852cc82e2</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,8ac37562-148c-40cc-aa39-ba8852cc82e2.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,8ac37562-148c-40cc-aa39-ba8852cc82e2.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8ac37562-148c-40cc-aa39-ba8852cc82e2</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>ASP.NET MVC 3 RC2 binding errors</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,8ac37562-148c-40cc-aa39-ba8852cc82e2.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVC3RC2BindingErrors.aspx</link>
      <pubDate>Mon, 13 Dec 2010 02:29:59 GMT</pubDate>
      <description>I updated my web sites to &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/12/10/announcing-asp-net-mvc-3-release-candidate-2.aspx" target="_blank"&gt;ASP.NET
MVC 3 RC2&lt;/a&gt;, and started receiving exceptions when model binding. If you want the
short version, visit this &lt;a href="http://forums.asp.net/t/1632006.aspx?ASP.NET+MVC3+RC2+bug+binding+from+request+parameters+to+method+parameters" target="_blank"&gt;forum
post&lt;/a&gt; for the answer. While my errors weren't caused by the same issue that was
originally reported in that thread, the fix does work. To sum up even further, just
add this line of code in your Global.asax Application_Start method: &lt;pre&gt;&lt;code&gt; ModelMetadataProviders.Current
= new DataAnnotationsModelMetadataProvider(); &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The longer story is that I have a pretty involved multi-step (think "wizard"), deep-level
object graph built up over many pages, so I immediately feared that I was unknowingly
exploiting some loophole that just got fixed for RC2. I built a test case, so in the
interest of not having to build that test case up from scratch again, it looked like
this:&lt;br /&gt;
&lt;b&gt;Model&lt;/b&gt; &lt;pre&gt;&lt;code&gt; public class Foo { private List&amp;lt;Bar&amp;gt; _bars; private
List&amp;lt;Baz&amp;gt; _bazs; public Foo() { _bars = new List&amp;lt;Bar&amp;gt;(); _bazs = new List&amp;lt;Baz&amp;gt;();
} public List&amp;lt;Bar&amp;gt; Bars { get { return _bars; } set { _bars = value; } } public
List&amp;lt;Baz&amp;gt; Bazs { get { return _bazs; } set { _bazs = value; } } } public class
Bar { public int Amount { get; set; } } public class Baz { public int Value { get;
set; } } &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
&lt;b&gt;Controller&lt;/b&gt; &lt;pre&gt;&lt;code&gt; public ActionResult Index() { var foo = new Foo(); foo.Bars.Add(new
Bar { Amount = 4}); foo.Bars.Add(new Bar { Amount = 23 }); foo.Bars.Add(new Bar {
Amount = 30 }); foo.Bazs.Add(new Baz { Value = 100 }); foo.Bazs.Add(new Baz { Value
= 200 }); TempData["foo"] = foo; return View(foo); } [HttpPost] public ActionResult
Index(IList&amp;lt;Bar&amp;gt; bars, IList&amp;lt;Baz&amp;gt; bazs) { Foo foo = (Foo) TempData["foo"];
foo.Bars.Clear(); foo.Bars.AddRange(bars); foo.Bazs.Clear(); foo.Bazs.AddRange(bazs);
TempData["foo"] = foo; return RedirectToAction("Summary"); } public ActionResult Summary()
{ Foo foo = (Foo)TempData["foo"]; return View(foo); } &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
&lt;b&gt;View&lt;/b&gt; &lt;pre&gt;&lt;code&gt; &amp;lt;% using(Html.BeginForm()) { %&amp;gt; &amp;lt;% int barid = 0;
foreach (var item in Model.Bars){%&amp;gt; 
&lt;br /&gt;
&amp;lt;%= Html.Hidden("Bars.index", barid) %&amp;gt; Bar:&amp;lt;%= Html.TextBox("Bars[" + barid
+"].Amount", item.Amount) %&amp;gt; &amp;lt;% barid++; }%&amp;gt; &amp;lt;% int bazid = 0; foreach
(var item in Model.Bazs) {%&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;%=Html.Hidden("Bazs.index", bazid)%&amp;gt;
Baz: &amp;lt;%=Html.TextBox("Bazs[" + bazid + "].Value", item.Value)%&amp;gt; &amp;lt;% bazid++;
}%&amp;gt; &amp;lt;p /&amp;gt; &amp;lt;input type="submit" value="Next" /&amp;gt; &amp;lt;% } %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
I would receive the following call stack when trying to submit the form: &lt;pre&gt;&lt;code&gt; The
parameters dictionary contains an invalid entry for parameter 'bazs' for method 'System.Web.Mvc.ActionResult
Index(System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Bar], System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Baz])'
in 'MvcApplicationRC2.Controllers.HomeController'. The dictionary contains a value
of type 'System.Collections.Generic.List`1[MvcApplicationRC2.Models.Bar]', but the
parameter requires a value of type 'System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Baz]'.
Parameter name: parameters Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code. Exception Details: System.ArgumentException:
The parameters dictionary contains an invalid entry for parameter 'bazs' for method
'System.Web.Mvc.ActionResult Index(System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Bar],
System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Baz])' in 'MvcApplicationRC2.Controllers.HomeController'.
The dictionary contains a value of type 'System.Collections.Generic.List`1[MvcApplicationRC2.Models.Bar]',
but the parameter requires a value of type 'System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Baz]'.
Parameter name: parameters Source Error: An unhandled exception was generated during
the execution of the current web request. Information regarding the origin and location
of the exception can be identified using the exception stack trace below. Stack Trace:
[ArgumentException: The parameters dictionary contains an invalid entry for parameter
'bazs' for method 'System.Web.Mvc.ActionResult Index(System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Bar],
System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Baz])' in 'MvcApplicationRC2.Controllers.HomeController'.
The dictionary contains a value of type 'System.Collections.Generic.List`1[MvcApplicationRC2.Models.Bar]',
but the parameter requires a value of type 'System.Collections.Generic.IList`1[MvcApplicationRC2.Models.Baz]'.
Parameter name: parameters] System.Web.Mvc.ActionDescriptor.ExtractParameterFromDictionary(ParameterInfo
parameterInfo, IDictionary`2 parameters, MethodInfo methodInfo) +484514 System.Web.Mvc.&amp;lt;&amp;gt;c__DisplayClass1.&amp;lt;Execute&amp;gt;b__0(ParameterInfo
parameterInfo) +18 System.Linq.WhereSelectArrayIterator`2.MoveNext() +85 System.Linq.Buffer`1..ctor(IEnumerable`1
source) +325 System.Linq.Enumerable.ToArray(IEnumerable`1 source) +78 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters) +133 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext
controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.&amp;lt;&amp;gt;c__DisplayClass15.&amp;lt;InvokeActionMethodWithFilters&amp;gt;b__12()
+55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter
filter, ActionExecutingContext preContext, Func`1 continuation) +263 System.Web.Mvc.&amp;lt;&amp;gt;c__DisplayClass17.&amp;lt;InvokeActionMethodWithFilters&amp;gt;b__14()
+19 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext
controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2
parameters) +191 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName) +343 System.Web.Mvc.Controller.ExecuteCore()
+116 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext
requestContext) +10 System.Web.Mvc.&amp;lt;&amp;gt;c__DisplayClassb.&amp;lt;BeginProcessRequest&amp;gt;b__5()
+37 System.Web.Mvc.Async.&amp;lt;&amp;gt;c__DisplayClass1.&amp;lt;MakeVoidDelegate&amp;gt;b__0() +21
System.Web.Mvc.Async.&amp;lt;&amp;gt;c__DisplayClass8`1.&amp;lt;BeginSynchronous&amp;gt;b__7(IAsyncResult
_) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.&amp;lt;&amp;gt;c__DisplayClasse.&amp;lt;EndProcessRequest&amp;gt;b__d()
+50 System.Web.Mvc.SecurityUtil.&amp;lt;GetCallInAppTrustThunk&amp;gt;b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action
action) +22 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
+60 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult
result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+8841105 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
+184 &lt;/code&gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8ac37562-148c-40cc-aa39-ba8852cc82e2" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,8ac37562-148c-40cc-aa39-ba8852cc82e2.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=8f6be955-9399-4d6a-b3ff-e6a13ee7b868</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,8f6be955-9399-4d6a-b3ff-e6a13ee7b868.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,8f6be955-9399-4d6a-b3ff-e6a13ee7b868.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8f6be955-9399-4d6a-b3ff-e6a13ee7b868</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">With the near-release of <a href="http://feeds.haacked.com/~r/haacked/~3/Xjn6-godT1g/asp-net-mvc-3-release-candidate.aspx" target="_new">ASP.NET
MVC 3</a>, I've been looking at the new <a href="http://weblogs.asp.net/scottgu/archive/2010/10/22/asp-net-mvc-3-layouts.aspx" target="_new">Razor
view engine</a>. It's quite nicely done and removes the constant "context switching"
between code and layout. 
<p />
In my web site, I used Scott Hanselman's <a href="http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx" target="_new">auto-detecting
view engine</a>, and it has served me extremely well. However, with the relentless
march of technology releases, a couple things should be pointed out: 
<p /><ul><li>
If you want to use Razor on the mobile side, you just need to inherit his original
class from <code>RazorViewEngine</code> instead of <code>WebFormViewEngine</code>.
(Obviously you should probably do this in a new class, or else the original class
name of MobileCapabeWebFormViewEngine will not exactly match up to what the class
actually does).</li><li>
The original <a href="http://mdbf.codeplex.com/" target="_new">Mobile Device Browser
File project</a> has disbanded. Very sad news, as this was a nice project that kept
on top of new smart phones as they were released. It looks like <a href="http://51degrees.codeplex.com/" target="_new">51
degrees</a> has stepped up to give us an alternative. I opened up an issue to request
providing this <a href="http://51degrees.codeplex.com/workitem/7500" target="_new">as
a NuGet package</a>. I'll definitely sign up to take this task on if it gains traction,
and they want the help.</li></ul><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8f6be955-9399-4d6a-b3ff-e6a13ee7b868" /></body>
      <title>MobileCapableWebFormViewEngine update</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,8f6be955-9399-4d6a-b3ff-e6a13ee7b868.aspx</guid>
      <link>http://www.distribucon.com/blog/MobileCapableWebFormViewEngineUpdate.aspx</link>
      <pubDate>Wed, 10 Nov 2010 02:04:33 GMT</pubDate>
      <description>With the near-release of &lt;a href="http://feeds.haacked.com/~r/haacked/~3/Xjn6-godT1g/asp-net-mvc-3-release-candidate.aspx" target="_new"&gt;ASP.NET
MVC 3&lt;/a&gt;, I've been looking at the new &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/10/22/asp-net-mvc-3-layouts.aspx" target="_new"&gt;Razor
view engine&lt;/a&gt;. It's quite nicely done and removes the constant "context switching"
between code and layout. 
&lt;p /&gt;
In my web site, I used Scott Hanselman's &lt;a href="http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx" target="_new"&gt;auto-detecting
view engine&lt;/a&gt;, and it has served me extremely well. However, with the relentless
march of technology releases, a couple things should be pointed out: 
&lt;p /&gt;
&lt;ul&gt;
&lt;li&gt;
If you want to use Razor on the mobile side, you just need to inherit his original
class from &lt;code&gt;RazorViewEngine&lt;/code&gt; instead of &lt;code&gt;WebFormViewEngine&lt;/code&gt;.
(Obviously you should probably do this in a new class, or else the original class
name of MobileCapabeWebFormViewEngine will not exactly match up to what the class
actually does).&lt;/li&gt;
&lt;li&gt;
The original &lt;a href="http://mdbf.codeplex.com/" target="_new"&gt;Mobile Device Browser
File project&lt;/a&gt; has disbanded. Very sad news, as this was a nice project that kept
on top of new smart phones as they were released. It looks like &lt;a href="http://51degrees.codeplex.com/" target="_new"&gt;51
degrees&lt;/a&gt; has stepped up to give us an alternative. I opened up an issue to request
providing this &lt;a href="http://51degrees.codeplex.com/workitem/7500" target="_new"&gt;as
a NuGet package&lt;/a&gt;. I'll definitely sign up to take this task on if it gains traction,
and they want the help.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=8f6be955-9399-4d6a-b3ff-e6a13ee7b868" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,8f6be955-9399-4d6a-b3ff-e6a13ee7b868.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I use <a href="http://stackoverflow.com/questions/653514/asp-net-mvc-model-binding-an-ilist-parameter" target="_new">list
binding</a> in my ASP.NET MVC applications in several places. When it works, it is
truly magnificent. When it doesn't, it's just maddening. Here's a quick heads up for
those of you that use list binding in MVC. You would expect the following 2 lines
to render the same HTML, but they don't. To get list binding to work, you need the
HTML to read something like this (I'm just listing the attributes in question here): 
<p /><pre><code> &lt;input name="Results[0].Score" /&gt; </code></pre><p />
The old TextBox helper works fine, since you're assigning the name attribute:<br /><pre><code> Html.TextBox("Results["+id+"].Score", Model.Score) </code></pre><p />
This code, however: <pre><code> Html.TextBoxFor(r =&gt; r.Score, new { name = "Results["
+ id + "].Score" }) </code></pre><p />
produces the following output, which means the Score property won't get bound properly. <pre><code> &lt;input
name="Score" /&gt; </code></pre><p />
The problem is that in the TextBoxFor code, the name attribute is ignored. To be more
precise, the custom name is added, but the attribute is then replaced by the name
derived from the model. <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135" /></body>
      <title>ASP.NET MVC list binding differences between TextBox and TextBoxFor</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVCListBindingDifferencesBetweenTextBoxAndTextBoxFor.aspx</link>
      <pubDate>Wed, 24 Feb 2010 04:12:13 GMT</pubDate>
      <description>I use &lt;a href="http://stackoverflow.com/questions/653514/asp-net-mvc-model-binding-an-ilist-parameter" target="_new"&gt;list
binding&lt;/a&gt; in my ASP.NET MVC applications in several places. When it works, it is
truly magnificent. When it doesn't, it's just maddening. Here's a quick heads up for
those of you that use list binding in MVC. You would expect the following 2 lines
to render the same HTML, but they don't. To get list binding to work, you need the
HTML to read something like this (I'm just listing the attributes in question here): 
&lt;p /&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;input name="Results[0].Score" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The old TextBox helper works fine, since you're assigning the name attribute:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt; Html.TextBox("Results["+id+"].Score", Model.Score) &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
This code, however: &lt;pre&gt;&lt;code&gt; Html.TextBoxFor(r =&amp;gt; r.Score, new { name = "Results["
+ id + "].Score" }) &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
produces the following output, which means the Score property won't get bound properly. &lt;pre&gt;&lt;code&gt; &amp;lt;input
name="Score" /&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The problem is that in the TextBoxFor code, the name attribute is ignored. To be more
precise, the custom name is added, but the attribute is then replaced by the name
derived from the model. &lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=2f555d4f-9a98-46e3-8aa4-0dbc6a20d135" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,2f555d4f-9a98-46e3-8aa4-0dbc6a20d135.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=e6c300f9-9863-43da-958f-b8bfa4807a9a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e6c300f9-9863-43da-958f-b8bfa4807a9a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I just updated my ASP.NET MVC 1.0 application
to use <a href="http://go.microsoft.com/fwlink/?LinkID=157071" target="_blank">ASP.NET
MVC 2 RC</a>. It was a pretty painless process. Be sure to follow the Release Notes
on the download page, and many applications will be ready to go. Here are some extra
things that might help get you unstuck:<br /><ul><li>
If you're using the ASP.NET MVC Futures (Microsoft.Web.Mvc) assembly, be sure to download
the <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37423" target="_blank">new
one that works with ASP.NET MVC 2</a>.</li><li>
If you're using the Telerik ASP.NET MVC components, be sure to download version BETA
2009.3.1218 or later.</li><li>
Way, way, way back in the ASP.NET MVC 1.0 beta days, they had a very nice mechanism
to update lists of items by tying UI fields to index numbers, so you could use primary
key identifiers to help keep track of what fields were modified where. In the 1.0
RC release, Microsoft <a href="http://forums.asp.net/p/1377775/2906357.aspx" target="_blank">changed
how it worked to do things sequentially instead</a>. I was using the IndexModelBinder
found in that thread with great success ever since then. However, Microsoft added
back in the index support to ASP.NET MVC 2 RC. This means that you will have to delete
the old IndexModelBinder since it won't compile anymore. Thankfully, I didn't have
to change a line of my code. Nice job of code compatibility!!</li></ul><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e6c300f9-9863-43da-958f-b8bfa4807a9a" /></body>
      <title>ASP.NET MVC 2 RC Changes</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVC2RCChanges.aspx</link>
      <pubDate>Tue, 19 Jan 2010 02:52:39 GMT</pubDate>
      <description>I just updated my ASP.NET MVC 1.0 application to use &lt;a href="http://go.microsoft.com/fwlink/?LinkID=157071" target="_blank"&gt;ASP.NET
MVC 2 RC&lt;/a&gt;. It was a pretty painless process. Be sure to follow the Release Notes
on the download page, and many applications will be ready to go. Here are some extra
things that might help get you unstuck:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
If you're using the ASP.NET MVC Futures (Microsoft.Web.Mvc) assembly, be sure to download
the &lt;a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=37423" target="_blank"&gt;new
one that works with ASP.NET MVC 2&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
If you're using the Telerik ASP.NET MVC components, be sure to download version BETA
2009.3.1218 or later.&lt;/li&gt;
&lt;li&gt;
Way, way, way back in the ASP.NET MVC 1.0 beta days, they had a very nice mechanism
to update lists of items by tying UI fields to index numbers, so you could use primary
key identifiers to help keep track of what fields were modified where. In the 1.0
RC release, Microsoft &lt;a href="http://forums.asp.net/p/1377775/2906357.aspx" target="_blank"&gt;changed
how it worked to do things sequentially instead&lt;/a&gt;. I was using the IndexModelBinder
found in that thread with great success ever since then. However, Microsoft added
back in the index support to ASP.NET MVC 2 RC. This means that you will have to delete
the old IndexModelBinder since it won't compile anymore. Thankfully, I didn't have
to change a line of my code. Nice job of code compatibility!!&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=e6c300f9-9863-43da-958f-b8bfa4807a9a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,e6c300f9-9863-43da-958f-b8bfa4807a9a.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=7894225c-ffc2-429b-9829-a49998567094</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7894225c-ffc2-429b-9829-a49998567094</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Telerik just released an extremely impressive <a href="http://demos.telerik.com/aspnet-mvc/" target="_blank">library
of components</a> (Grid, Menu, TabStrip, and MenuBar), written for MVC. They are truly
first-class, from the architecture, to the development experience, to the finished
screens that your user sees. They released them as open-source, and even better, these
controls are written from the ground up to support ASP.NET MVC. 
<p />
Be sure to check out this awesome write up on how to <a href="http://weblogs.asp.net/rashid/archive/2009/11/05/using-telerik-mvc-grid-in-crud-scenario.aspx" target="_blank">Use
the grid in a CRUD scenario</a>. Very nicely done. 
<p />
I'm not a fan of the whole "Edit/Delete" action column. I'd much rather just have
a link on the column to take me to the detail screen. Here's the way I solved that: <pre><code> &lt;%
Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns
=&gt; { columns.Add(o =&gt; o.CollectionDate).Template(c =&gt; { %&gt; &lt;%= Html.ActionLink(c.CollectionDate.ToShortDateString(),
"View", new { Id = c.Id })%&gt; &lt;% }).Width(40); columns.Add(o =&gt; o.Location.Name).Width(40);
}) .Scrollable() .Sortable() .Pageable() .Filterable() .Render(); %&gt; </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7894225c-ffc2-429b-9829-a49998567094" /></body>
      <title>Telerik Extensions for ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</guid>
      <link>http://www.distribucon.com/blog/TelerikExtensionsForASPNETMVC.aspx</link>
      <pubDate>Sun, 08 Nov 2009 03:00:21 GMT</pubDate>
      <description>Telerik just released an extremely impressive &lt;a href="http://demos.telerik.com/aspnet-mvc/" target="_blank"&gt;library
of components&lt;/a&gt; (Grid, Menu, TabStrip, and MenuBar), written for MVC. They are truly
first-class, from the architecture, to the development experience, to the finished
screens that your user sees. They released them as open-source, and even better, these
controls are written from the ground up to support ASP.NET MVC. 
&lt;p /&gt;
Be sure to check out this awesome write up on how to &lt;a href="http://weblogs.asp.net/rashid/archive/2009/11/05/using-telerik-mvc-grid-in-crud-scenario.aspx" target="_blank"&gt;Use
the grid in a CRUD scenario&lt;/a&gt;. Very nicely done. 
&lt;p /&gt;
I'm not a fan of the whole "Edit/Delete" action column. I'd much rather just have
a link on the column to take me to the detail screen. Here's the way I solved that: &lt;pre&gt;&lt;code&gt; &amp;lt;%
Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns
=&amp;gt; { columns.Add(o =&amp;gt; o.CollectionDate).Template(c =&amp;gt; { %&gt; &amp;lt;%= Html.ActionLink(c.CollectionDate.ToShortDateString(),
"View", new { Id = c.Id })%&amp;gt; &amp;lt;% }).Width(40); columns.Add(o =&amp;gt; o.Location.Name).Width(40);
}) .Scrollable() .Sortable() .Pageable() .Filterable() .Render(); %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7894225c-ffc2-429b-9829-a49998567094" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5428f2ef-4962-44e0-ba14-1f18cb8bedc3</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5428f2ef-4962-44e0-ba14-1f18cb8bedc3</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've never been happier that I chose a
technology after today. I have a production web application built using ASP.NET MVC,
and it has been working with almost no issues for over a year now. As a matter of
fact, it is the cornerstone used to run our business. I've had the default blue skin
in use since day 1 (ya, ya, I know, I know. I've been so lazy, I haven't even switched
out to <a href="http://www.asp.net/MVC/Gallery/" target="_blank">pre-built templates</a>),
and we run the app on the iPhone. It works, but there's always pinching, zooming and
scrolling going on. I finally bit the bullet after thinking to myself "Why not create
a view tailored to the iPhone to enhance the experience?" one too many times. About
12 hours later, the entire application was done with an auto-detected, optimized look
and feel for the iPhone. I am now convinced that I've just been paid back with the
technical dividends for investing in ASP.NET MVC. :) 
<p />
To help the next guy out who walks down this path, here are all of the links that
I used during this process: 
<ul><li><a href="http://weblogs.asp.net/aaronlerch/archive/2008/06/08/rock-the-iphone-with-asp-net-mvc.aspx" target="_blank">Aaron
Lerch's seminal article</a> on using iUI</li><li><a href="http://code.google.com/p/iui/" target="_blank">iUI project home page</a> (Be
sure to use 0.31. It is lightning fast!)</li><li><a href="http://www.hanselman.com/blog/TheWeeklySourceCode28IPhoneWithASPNETMVCEdition.aspx" target="_blank">Scott
Hanselman's article</a> that introduced the auto-detect view engine</li><li><a href="http://www.k10design.net/articles/iui/" target="_blank">CW Zachary's article</a> that
gives some extensions to iUI (like tables, load/unload, and script/css execution)</li><li><a href="http://video.yahoo.com/watch/853528/3491272" target="_blank">Joe Hewitt's
introductory video</a>. Nice presentation, and the _replace nugget was worth the 15
minutes to watch it.</li></ul><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5428f2ef-4962-44e0-ba14-1f18cb8bedc3" /></body>
      <title>ASP.NET MVC on the iPhone</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVCOnTheIPhone.aspx</link>
      <pubDate>Fri, 06 Nov 2009 23:44:02 GMT</pubDate>
      <description>I've never been happier that I chose a technology after today. I have a production web application built using ASP.NET MVC, and it has been working with almost no issues for over a year now. As a matter of fact, it is the cornerstone used to run our business. I've had the default blue skin in use since day 1 (ya, ya, I know, I know. I've been so lazy, I haven't even switched out to &lt;a href="http://www.asp.net/MVC/Gallery/" target="_blank"&gt;pre-built
templates&lt;/a&gt;), and we run the app on the iPhone. It works, but there's always pinching,
zooming and scrolling going on. I finally bit the bullet after thinking to myself
"Why not create a view tailored to the iPhone to enhance the experience?" one too
many times. About 12 hours later, the entire application was done with an auto-detected,
optimized look and feel for the iPhone. I am now convinced that I've just been paid
back with the technical dividends for investing in ASP.NET MVC. :) 
&lt;p /&gt;
To help the next guy out who walks down this path, here are all of the links that
I used during this process: 
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://weblogs.asp.net/aaronlerch/archive/2008/06/08/rock-the-iphone-with-asp-net-mvc.aspx" target="_blank"&gt;Aaron
Lerch's seminal article&lt;/a&gt; on using iUI&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://code.google.com/p/iui/" target="_blank"&gt;iUI project home page&lt;/a&gt; (Be
sure to use 0.31. It is lightning fast!)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.hanselman.com/blog/TheWeeklySourceCode28IPhoneWithASPNETMVCEdition.aspx" target="_blank"&gt;Scott
Hanselman's article&lt;/a&gt; that introduced the auto-detect view engine&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.k10design.net/articles/iui/" target="_blank"&gt;CW Zachary's article&lt;/a&gt; that
gives some extensions to iUI (like tables, load/unload, and script/css execution)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://video.yahoo.com/watch/853528/3491272" target="_blank"&gt;Joe Hewitt's
introductory video&lt;/a&gt;. Nice presentation, and the _replace nugget was worth the 15
minutes to watch it.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5428f2ef-4962-44e0-ba14-1f18cb8bedc3" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=53f4be36-1d7b-43f7-8691-286b480ec9d2</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=53f4be36-1d7b-43f7-8691-286b480ec9d2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Since my <a href="http://www.distribucon.com/blog/PopulatingDateRanges.aspx" target="_blank">last
post</a>, the date has changed from October 9th to October 12th. The reason this is
important is that the functions that needed to calculate the date based on the current
date are now coming through a different code path. Before, everything worked great.
As of October 10th, not so much. The fix is simple - the getDate function was missing
the parentheses to make it a method call. The fix is quite simple and is listed below: <pre><code> var
day = (now.getDate() &lt; 10) ? "0" + now.getDate() : now.getDate(); </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=53f4be36-1d7b-43f7-8691-286b480ec9d2" /></body>
      <title>Populating Date Ranges, part 2</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</guid>
      <link>http://www.distribucon.com/blog/PopulatingDateRangesPart2.aspx</link>
      <pubDate>Tue, 13 Oct 2009 04:11:13 GMT</pubDate>
      <description>Since my &lt;a href="http://www.distribucon.com/blog/PopulatingDateRanges.aspx" target="_blank"&gt;last
post&lt;/a&gt;, the date has changed from October 9th to October 12th. The reason this is
important is that the functions that needed to calculate the date based on the current
date are now coming through a different code path. Before, everything worked great.
As of October 10th, not so much. The fix is simple - the getDate function was missing
the parentheses to make it a method call. The fix is quite simple and is listed below: &lt;pre&gt;&lt;code&gt; var
day = (now.getDate() &amp;lt; 10) ? "0" + now.getDate() : now.getDate(); &lt;/code&gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=53f4be36-1d7b-43f7-8691-286b480ec9d2" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=691a0e72-3786-4810-ad90-d064e6090fac</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=691a0e72-3786-4810-ad90-d064e6090fac</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I have several reports in my ASP.NET MVC
application that are date-oriented. I had start date and end date text boxes, and
things worked fine. What I really wanted was something that would allow those date
boxes to be populated with a variety of canned date ranges (e.g. Year to Date, Last
Month, etc.). I found just what I was looking for in a pure JavaScript implementation <a href="http://www.epalla.com/2009/06/using-javascript-to-calculate-dates/" target="_blank">here</a>. 
<p />
The one problem I found was that "Last Month" was being calculated incorrectly. Below
is the simple fix. Thanks to epalla for the original code. 
<p /><pre><code> // last month case "lastmo": // we need a new month variable for month-1,
also formatted correctly var lastmonth = ((month - 1) &lt; 10) ? "0" + (month - 1)
: (month - 1); startbox.value = lastmonth + "/01/" + year; // now grab the last day
of the month (30, 31? we don't know!) var moend = new Date(year, (month - 1), 0);
endbox.value = lastmonth + "/" + moend.getDate() + "/" + year; break; </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=691a0e72-3786-4810-ad90-d064e6090fac" /></body>
      <title>Populating Date Ranges</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</guid>
      <link>http://www.distribucon.com/blog/PopulatingDateRanges.aspx</link>
      <pubDate>Fri, 09 Oct 2009 01:44:07 GMT</pubDate>
      <description>I have several reports in my ASP.NET MVC application that are date-oriented. I had start date and end date text boxes, and things worked fine. What I really wanted was something that would allow those date boxes to be populated with a variety of canned date ranges (e.g. Year to Date, Last Month, etc.). I found just what I was looking for in a pure JavaScript implementation &lt;a href="http://www.epalla.com/2009/06/using-javascript-to-calculate-dates/" target="_blank"&gt;here&lt;/a&gt;. 
&lt;p /&gt;
The one problem I found was that "Last Month" was being calculated incorrectly. Below
is the simple fix. Thanks to epalla for the original code. 
&lt;p /&gt;
&lt;pre&gt;&lt;code&gt; // last month case "lastmo": // we need a new month variable for month-1,
also formatted correctly var lastmonth = ((month - 1) &amp;lt; 10) ? "0" + (month - 1)
: (month - 1); startbox.value = lastmonth + "/01/" + year; // now grab the last day
of the month (30, 31? we don't know!) var moend = new Date(year, (month - 1), 0);
endbox.value = lastmonth + "/" + moend.getDate() + "/" + year; break; &lt;/code&gt;&lt;/pre&gt;&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=691a0e72-3786-4810-ad90-d064e6090fac" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Given a set up like this (where ExpenseSummaryData
returns some arbitrary HTML fragment) : <pre><code> &lt;%using (Ajax.BeginForm("ExpenseSummaryData",
new AjaxOptions { UpdateTargetId = "result" })) { %&gt; &lt;label for="startDate"&gt;Start
Date:&lt;/label&gt; &lt;%= Html.TextBox("startDate") %&gt; &lt;br /&gt; &lt;label
for="endDate"&gt;End Date:&lt;/label&gt; &lt;%= Html.TextBox("endDate")%&gt; &lt;br
/&gt; &lt;input type="submit"/&gt; &lt;br /&gt; &lt;span id="result"/&gt; &lt;% }
%&gt; </code></pre><p />
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
<p />
The reason for this is that I forgot to add the following lines to the &lt;head&gt;
section in the original page: <pre><code> &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; </code></pre><p />
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /></body>
      <title>Why AJAX posts go to a new page instead of updating UpdateTargetId</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</guid>
      <link>http://www.distribucon.com/blog/WhyAJAXPostsGoToANewPageInsteadOfUpdatingUpdateTargetId.aspx</link>
      <pubDate>Sun, 31 May 2009 16:38:24 GMT</pubDate>
      <description>Given a set up like this (where ExpenseSummaryData returns some arbitrary HTML fragment) :
&lt;pre&gt;&lt;code&gt; &amp;lt;%using
(Ajax.BeginForm("ExpenseSummaryData", new AjaxOptions { UpdateTargetId = "result"
})) { %&amp;gt; &amp;lt;label for="startDate"&amp;gt;Start Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("startDate")
%&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;label for="endDate"&amp;gt;End Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("endDate")%&amp;gt;
&amp;lt;br /&amp;gt; &amp;lt;input type="submit"/&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;span id="result"/&amp;gt; &amp;lt;%
} %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
&lt;p /&gt;
The reason for this is that I forgot to add the following lines to the &amp;lt;head&amp;gt;
section in the original page: &lt;pre&gt;&lt;code&gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=ac208445-ed41-40cb-98ac-af77d227ef51</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ac208445-ed41-40cb-98ac-af77d227ef51</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've been playing with ways to write a solid (and even <a href="http://www.hanselminutes.com/default.aspx?showID=163" target="_blank">SOLID</a> :))
architecture with ASP.NET MVC. I started with a plain LINQ to SQL approach, and then
migrated to <a href="http://www.mindscape.co.nz/products/LightSpeed/default.aspx" target="_blank">LightSpeed</a>,
and finally ended up checking out <a href="http://groups.google.com/group/sharp-architecture" target="_blank">S#arp</a> last
week. Here are my notes of pros/cons on each approach. Yes, I could (and most likely
will) address some concerns by writing code for it. This is more of a laundry list
of the state of things as I see them at this point in time.
</p>
        <h3>LINQ to SQL
</h3>
        <h4>Pros
</h4>
        <ul>
          <li>
Visual designer 
</li>
        </ul>
        <h4>Cons
</h4>
        <ul>
          <li>
MS is talking about <a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" target="_blank">phasing
LINQ to SQL out</a> and forcing people towards Entity Framework. I'm pretty sick of
chasing MS's data-access strategies around every year. 
</li>
          <li>
LINQ to SQL mostly defaults you to a 1:1 mapping between your database and your model. 
</li>
          <li>
Support for modifications to the schema sucks, to be generous. 
</li>
          <li>
No UnitOfWork concept. Of course, as I prepared this blog entry, I found <a href="http://www.geekvue.com/2009/02/26/implementing-unitofwork-pattern-in-linq-to-sql-application/" target="_blank">this
article</a> published just today, so maybe that would address this point. 
</li>
        </ul>
        <h3>LightSpeed
</h3>
        <h4>Pros
</h4>
        <ul>
          <li>
Support is outstanding. 
</li>
          <li>
Nightly builds are available. 
</li>
          <li>
Visual designer. 
</li>
          <li>
Proven patterns bundled in their core libraries (UnitOfWork, Repository, Entity, etc.). 
</li>
          <li>
Picks up changes from the schema flawlessly. 
</li>
        </ul>
        <h4>Cons
</h4>
        <ul>
          <li>
Commercial and propietary. 
</li>
          <li>
Lacks quite a bit of LINQ support. For example, <a href="http://www.mindscape.co.nz/forums/Thread.aspx?PostID=3377" target="_blank">groupby
and join</a> are not supported. This meant that I use LINQ to SQL when I need these
features. Fortunately, that's all isolated to my report module, so it's not as horrible
as it could be. 
</li>
        </ul>
        <h3>S#arp
</h3>
        <h4>Pros
</h4>
        <ul>
          <li>
Open Source 
</li>
          <li>
Uses standard, widely adopted open source libraries: NHibernate, Windsor, etc. 
</li>
          <li>
Convention over Configuration 
</li>
          <li>
Scaffolding</li>
        </ul>
        <h4>Cons
</h4>
        <ul>
          <li>
I'm not digging the T4 templating mechanism. They conflict with VisualSVN and Developer
Express tools, and having to write a template for each and every entity is cumbersome. 
</li>
          <li>
No visual designer 
</li>
          <li>
No ability to import entities from an existing database. Yes, they like DDD, but in
almost every project I've been a part of, the database is the thing that already exists. 
</li>
          <li>
No UnitOfWork pattern (I might be able to fit code out there that does this in with
S#arp). The [Transaction] attribute approach feels a bit dirty. 
</li>
          <li>
The scaffolding is a bit too simple. It doesn't build up object graphs with links
(for display) or SelectLists (for editing). Yes, I can add that. It probably will
get that functionality at some point, too. But it doesn't do it right now.</li>
        </ul>
        <p>
For now, I think I'll be staying with LightSpeed, but I'll be watching S#arp very
carefully.
</p>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ac208445-ed41-40cb-98ac-af77d227ef51" />
      </body>
      <title>ASP.NET MVC Architecture Round-up</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</guid>
      <link>http://www.distribucon.com/blog/ASPNETMVCArchitectureRoundup.aspx</link>
      <pubDate>Thu, 26 Feb 2009 21:17:53 GMT</pubDate>
      <description>&lt;p&gt;
I've been playing with ways to write a solid (and even &lt;a href="http://www.hanselminutes.com/default.aspx?showID=163" target="_blank"&gt;SOLID&lt;/a&gt; :))
architecture with ASP.NET MVC. I started with a plain LINQ to SQL approach, and then
migrated to &lt;a href="http://www.mindscape.co.nz/products/LightSpeed/default.aspx" target="_blank"&gt;LightSpeed&lt;/a&gt;,
and finally ended up checking out &lt;a href="http://groups.google.com/group/sharp-architecture" target="_blank"&gt;S#arp&lt;/a&gt; last
week. Here are my notes of pros/cons on each approach. Yes, I could (and most likely
will) address some concerns by writing code for it. This is more of a laundry list
of the state of things as I see them at this point in time.
&lt;/p&gt;
&lt;h3&gt;LINQ to SQL
&lt;/h3&gt;
&lt;h4&gt;Pros
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Visual designer 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Cons
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
MS is talking about &lt;a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" target="_blank"&gt;phasing
LINQ to SQL out&lt;/a&gt; and forcing people towards Entity Framework. I'm pretty sick of
chasing MS's data-access strategies around every year. 
&lt;li&gt;
LINQ to SQL mostly defaults you to a 1:1 mapping between your database and your model. 
&lt;li&gt;
Support for modifications to the schema sucks, to be generous. 
&lt;li&gt;
No UnitOfWork concept. Of course, as I prepared this blog entry, I found &lt;a href="http://www.geekvue.com/2009/02/26/implementing-unitofwork-pattern-in-linq-to-sql-application/" target="_blank"&gt;this
article&lt;/a&gt; published just today, so maybe that would address this point. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;LightSpeed
&lt;/h3&gt;
&lt;h4&gt;Pros
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Support is outstanding. 
&lt;li&gt;
Nightly builds are available. 
&lt;li&gt;
Visual designer. 
&lt;li&gt;
Proven patterns bundled in their core libraries (UnitOfWork, Repository, Entity, etc.). 
&lt;li&gt;
Picks up changes from the schema flawlessly. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Cons
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Commercial and propietary. 
&lt;li&gt;
Lacks quite a bit of LINQ support. For example, &lt;a href="http://www.mindscape.co.nz/forums/Thread.aspx?PostID=3377" target="_blank"&gt;groupby
and join&lt;/a&gt; are not supported. This meant that I use LINQ to SQL when I need these
features. Fortunately, that's all isolated to my report module, so it's not as horrible
as it could be. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;S#arp
&lt;/h3&gt;
&lt;h4&gt;Pros
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
Open Source 
&lt;li&gt;
Uses standard, widely adopted open source libraries: NHibernate, Windsor, etc. 
&lt;li&gt;
Convention over Configuration 
&lt;li&gt;
Scaffolding&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Cons
&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
I'm not digging the T4 templating mechanism. They conflict with VisualSVN and Developer
Express tools, and having to write a template for each and every entity is cumbersome. 
&lt;li&gt;
No visual designer 
&lt;li&gt;
No ability to import entities from an existing database. Yes, they like DDD, but in
almost every project I've been a part of, the database is the thing that already exists. 
&lt;li&gt;
No UnitOfWork pattern (I might be able to fit code out there that does this in with
S#arp). The [Transaction] attribute approach feels a bit dirty. 
&lt;li&gt;
The scaffolding is a bit too simple. It doesn't build up object graphs with links
(for display) or SelectLists (for editing). Yes, I can add that. It probably will
get that functionality at some point, too. But it doesn't do it right now.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For now, I think I'll be staying with LightSpeed, but I'll be watching S#arp very
carefully.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=ac208445-ed41-40cb-98ac-af77d227ef51" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,ac208445-ed41-40cb-98ac-af77d227ef51.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=727ded4f-19b9-41c6-a7b9-2062f0fc570a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,727ded4f-19b9-41c6-a7b9-2062f0fc570a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,727ded4f-19b9-41c6-a7b9-2062f0fc570a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=727ded4f-19b9-41c6-a7b9-2062f0fc570a</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
At work, a debate broke out over MVC. In that debate, <a href="http://chriscpetersonblog.blogspot.com/" target="_blank">Chris
Peterson</a> commented that he hated the way things looked on the view pages, specifically
with code executing in the view context. By way of example, he talked about the need
for a for loop to display a collection, and how he didn't like that. <a href="http://www.zorched.net" target="_blank">Geoff
Lane</a> commented that Grails had support for this built-in.
</p>
        <p>
To overcome these objections, I wrote the following simple extension method:
</p>
        <div style="font-weight: bold; font-size: 10pt; background: black; color: white; font-family: consolas">
          <p style="margin: 0px">
            <span style="color: #cc7832">public</span>
            <span style="color: #cc7832">static</span>
            <span style="color: #cc7832">class</span>
            <span style="color: #ffc66d">RenderPartialCollectionExtension</span>
          </p>
          <p style="margin: 0px">
{
</p>
          <p style="margin: 0px">
    <span style="color: #cc7832">public</span><span style="color: #cc7832">static</span><span style="color: #cc7832">void</span> RenderPartialCollection&lt;T&gt;(<span style="color: #cc7832">this</span><span style="color: #ffc66d">HtmlHelper</span> htmlHelper, <span style="color: #cc7832">string</span> partialViewName, <span style="color: #6897bb">IList</span><span style="font-weight: normal">&lt;T&gt;
list)</span></p>
          <p style="margin: 0px">
    {
</p>
          <p style="margin: 0px">
        <span style="color: #cc7832">foreach</span> (T
item <span style="color: #cc7832">in</span> list)
</p>
          <p style="margin: 0px">
        {
</p>
          <p style="margin: 0px">
            htmlHelper.RenderPartial(partialViewName,
item);
</p>
          <p style="margin: 0px">
        }
</p>
          <p style="margin: 0px">
    }
</p>
          <p style="margin: 0px">
}
</p>
        </div>
        <p>
This means that instead of the old-style View page code, like this: 
</p>
        <div style="font-weight: bold; font-size: 10pt; background: black; color: white; font-family: consolas">
          <p style="margin: 0px">
            <span style="color: #6897bb">&lt;%</span>
          </p>
          <p style="margin: 0px">
   <span style="color: #cc7832">foreach</span> (<span style="color: #ffc66d">Foo</span> foo <span style="color: #cc7832">in</span> Model)
</p>
          <p style="margin: 0px">
   {
</p>
          <p style="margin: 0px">
       Html.RenderPartial(<span style="color: #a5c25c">"~/Partials/DisplayFoo.aspx"</span>,
foo);
</p>
          <p style="margin: 0px">
   }
</p>
          <p style="margin: 0px">
 <span style="color: #6897bb">%&gt;</span></p>
        </div>
        <p>
You can just write code like this: 
</p>
        <div style="font-weight: bold; font-size: 10pt; background: black; color: white; font-family: consolas">
          <p style="margin: 0px">
            <span style="color: #6897bb">&lt;%</span> Html.RenderPartialCollection&lt;<span style="color: #ffc66d">Foo</span><span style="font-weight: normal">&gt;(</span><span style="color: #a5c25c">"~/Partials/DisplayFoo.aspx"</span>,
Model); <span style="color: #6897bb">%&gt;</span></p>
        </div>
        <img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=727ded4f-19b9-41c6-a7b9-2062f0fc570a" />
      </body>
      <title>RenderPartial for a collection</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,727ded4f-19b9-41c6-a7b9-2062f0fc570a.aspx</guid>
      <link>http://www.distribucon.com/blog/RenderPartialForACollection.aspx</link>
      <pubDate>Fri, 30 Jan 2009 22:40:58 GMT</pubDate>
      <description>&lt;p&gt;
At work, a debate broke out over MVC. In that debate, &lt;a href="http://chriscpetersonblog.blogspot.com/" target="_blank"&gt;Chris
Peterson&lt;/a&gt; commented that he hated the way things looked on the view pages, specifically
with code executing in the view context. By way of example, he talked about the need
for a for loop to display a collection, and how he didn't like that. &lt;a href="http://www.zorched.net" target="_blank"&gt;Geoff
Lane&lt;/a&gt; commented that Grails had support for this built-in.
&lt;/p&gt;
&lt;p&gt;
To overcome these objections, I wrote the following simple extension method:
&lt;/p&gt;
&lt;div style="font-weight: bold; font-size: 10pt; background: black; color: white; font-family: consolas"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #cc7832"&gt;class&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;RenderPartialCollectionExtension&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
{
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #cc7832"&gt;public&lt;/span&gt; &lt;span style="color: #cc7832"&gt;static&lt;/span&gt; &lt;span style="color: #cc7832"&gt;void&lt;/span&gt; RenderPartialCollection&amp;lt;T&amp;gt;(&lt;span style="color: #cc7832"&gt;this&lt;/span&gt; &lt;span style="color: #ffc66d"&gt;HtmlHelper&lt;/span&gt; htmlHelper, &lt;span style="color: #cc7832"&gt;string&lt;/span&gt; partialViewName, &lt;span style="color: #6897bb"&gt;IList&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;lt;T&amp;gt;
list)&lt;/span&gt;
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #cc7832"&gt;foreach&lt;/span&gt; (T
item &lt;span style="color: #cc7832"&gt;in&lt;/span&gt; list)
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; htmlHelper.RenderPartial(partialViewName,
item);
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
}
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
This means that instead of the old-style View page code, like this: 
&lt;div style="font-weight: bold; font-size: 10pt; background: black; color: white; font-family: consolas"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #6897bb"&gt;&amp;lt;%&lt;/span&gt; 
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp; &lt;span style="color: #cc7832"&gt;foreach&lt;/span&gt; (&lt;span style="color: #ffc66d"&gt;Foo&lt;/span&gt; foo &lt;span style="color: #cc7832"&gt;in&lt;/span&gt; Model)
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp; {
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Html.RenderPartial(&lt;span style="color: #a5c25c"&gt;"~/Partials/DisplayFoo.aspx"&lt;/span&gt;,
foo);
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&amp;nbsp; }
&lt;/p&gt;
&lt;p style="margin: 0px"&gt;
&amp;nbsp;&lt;span style="color: #6897bb"&gt;%&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
You can just write code like this: 
&lt;div style="font-weight: bold; font-size: 10pt; background: black; color: white; font-family: consolas"&gt;
&lt;p style="margin: 0px"&gt;
&lt;span style="color: #6897bb"&gt;&amp;lt;%&lt;/span&gt; Html.RenderPartialCollection&amp;lt;&lt;span style="color: #ffc66d"&gt;Foo&lt;/span&gt;&lt;span style="font-weight: normal"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="color: #a5c25c"&gt;"~/Partials/DisplayFoo.aspx"&lt;/span&gt;,
Model); &lt;span style="color: #6897bb"&gt;%&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=727ded4f-19b9-41c6-a7b9-2062f0fc570a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,727ded4f-19b9-41c6-a7b9-2062f0fc570a.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=627e837f-cfbd-4194-b775-11d220a18b11</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,627e837f-cfbd-4194-b775-11d220a18b11.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,627e837f-cfbd-4194-b775-11d220a18b11.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=627e837f-cfbd-4194-b775-11d220a18b11</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
It seems that ASP.NET MVC doesn't allow for strongly-typed partial views. If anyone
knows of a clean way to do it, I'd love to know!
</p>
        <p>
Take the following typical page declaration:
</p>
        <pre>
          <code>&lt;%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage&lt;Foo&gt;"
%&gt;</code>
        </pre>
        <p>
This declaration allows us to access the Foo.Bar property in the view page using the
following syntax: Model.Bar. This works really well, and we even get Intellisense
for Foo when accessing the Model property in the editor. In contrast, if we inherited
from the non-generic ViewPage, Model becomes a simple object type, which means type-casting
to get to our passed in model object. 
</p>
        <p>
However, using partial pages with a similar technique does not work. For example,
if we have a partial page (ViewPage or ViewUserControl) and call it like below, it
will not allow for strong typing of the page: 
</p>
        <pre>
          <code>Html.RenderPartial("DisplayFoo", foo)</code>
        </pre>If we try to strongly
type the page, it will result in an error like this at run-time: <pre><code>Parser
Error Message: Could not load type 'System.Web.Mvc.ViewPage<foo>
'.
</foo></code></pre><p>
One work-around is to create a code-behind file, and specify the strong typing there,
and then inherit the partial page from the code-behind. But I really don't like that.
RC1 made great strides to get rid of the code-behind mess, and I would prefer not
to reintroduce it just for this. 
</p><p><b>Update:</b> Thanks to bradleylandis in the ASP.NET MVC forum, he correctly figured
out that I had my partial page in a folder <i>other</i> than the Views folder. He
mentioned that you need to copy the web.config file from the Views folder to any folder
that you serve view pages out of. After doing that, I now have a strongly typed partial
page.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=627e837f-cfbd-4194-b775-11d220a18b11" /></p></body>
      <title>Strongly typed Partial Views</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,627e837f-cfbd-4194-b775-11d220a18b11.aspx</guid>
      <link>http://www.distribucon.com/blog/StronglyTypedPartialViews.aspx</link>
      <pubDate>Thu, 29 Jan 2009 19:22:09 GMT</pubDate>
      <description>&lt;p&gt;
It seems that ASP.NET MVC doesn't allow for strongly-typed partial views. If anyone
knows of a clean way to do it, I'd love to know!
&lt;/p&gt;
&lt;p&gt;
Take the following typical page declaration:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage&amp;lt;Foo&amp;gt;"
%&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
This declaration allows us to access the Foo.Bar property in the view page using the
following syntax: Model.Bar. This works really well, and we even get Intellisense
for Foo when accessing the Model property in the editor. In contrast, if we inherited
from the non-generic ViewPage, Model becomes a simple object type, which means type-casting
to get to our passed in model object. 
&lt;p&gt;
However, using partial pages with a similar technique does not work. For example,
if we have a partial page (ViewPage or ViewUserControl) and call it like below, it
will not allow for strong typing of the page: &lt;pre&gt;&lt;code&gt;Html.RenderPartial("DisplayFoo",
foo)&lt;/code&gt;&lt;/pre&gt;If we try to strongly type the page, it will result in an error like
this at run-time: &lt;pre&gt;&lt;code&gt;Parser Error Message: Could not load type 'System.Web.Mvc.ViewPage&lt;foo&gt;
'.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
One work-around is to create a code-behind file, and specify the strong typing there,
and then inherit the partial page from the code-behind. But I really don't like that.
RC1 made great strides to get rid of the code-behind mess, and I would prefer not
to reintroduce it just for this. 
&lt;p&gt;
&lt;b&gt;Update:&lt;/b&gt; Thanks to bradleylandis in the ASP.NET MVC forum, he correctly figured
out that I had my partial page in a folder &lt;i&gt;other&lt;/i&gt; than the Views folder. He
mentioned that you need to copy the web.config file from the Views folder to any folder
that you serve view pages out of. After doing that, I now have a strongly typed partial
page.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=627e837f-cfbd-4194-b775-11d220a18b11" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,627e837f-cfbd-4194-b775-11d220a18b11.aspx</comments>
      <category>ASP.NET MVC</category>
    </item>
  </channel>
</rss>