May 21

In the last section of my MVC Templates post, I discussed how to use the Html.EditorFor() helper with complex types. Whilst this showed how you can use Html.EditorFor() and templates to produce a user interface for complex types, it didn’t show you how to bind the result when the user has posted to a controllers action. In this post I will extend the employee example, so that it displays the offices the the user selected.

Continue reading »

Tagged with:
Apr 26

MVC 2 is official, I’ve been using it for a while now (since preview), my favorite feature by far is templating. I’ve been using the templating feature extensively to upgrade an existing production application, in particular some quite ugly views.

Before templates to create a reusable UI, you really only had the options of user controls or writing your own Html helpers, the former will almost certainly mean a compromise. I believe the templating feature will assist in the goals of separation of concerns and being DRY.
Continue reading »

Tagged with:
Mar 12

MVC 2 is officially released, there are so many excellent features,  but the best feature for me is the strongly typed Html helpers. I’ve been playing around with this feature and will share some of my experiences with you.

http://weblogs.asp.net/scottgu/archive/2010/03/11/asp-net-mvc-2-released.aspx

Tagged with:
Feb 06

Generally bug fixes and performance enhancements.

One cool addition for me, is the HTML input helpers supporting array/collection indexes, for example: Html.EditorFor(foo=>foo.bar[i]) . I was working around this limitation using Html.EditorFor((foo)=>foo.bar[i], “Bar”) i.e. passing a function expression, but this means you have to pass a template name (to get the correct HtmlFieldPrefix), this addition means cleaner code and no hard references to templates, thanks MVC team.

Another notable change is Query 1.4.1, is now included by default with ASP.NET MVC 2 projects.

More info @ScottGu’s blog: http://weblogs.asp.net/scottgu/archive/2010/02/05/asp-net-mvc-2-release-candidate-2-now-available.aspx

Tagged with:
Nov 17

I recently downloaded ASP.NET MVC 2.0 Preview 2 and was surprised to see, that the NUnit test templates haven’t made it into the build. Again we are stuck with MSUnit being the only template available.

msunit

Fear not help is at hand Joe Cartano posted an excellent solution for MVC 1.0.  I have made a minor one line tweak (in NUnit.reg) to his solution, so that it works with MVC 2.0.  After reading some of the comments on the Visual Web Developer Team Blog, it was apparent that some people are having issues installing the templates, here is a very quick guide: Continue reading »

Tagged with:
preload preload preload