Mike Bosch's Blog on .NET

I'm leaving the weblogs.asp.net blogging community to my own personal web space. I appreciate all the exposure I've received through the years here and I hope you'll follow me to the blogs new home. I'll be covering the same topics you've seen here and have already migrated the posts over.

I recently read a Gartner research report about the changing space of software development methodologies and the PMO. It compared the PMO to an air traffic controller coordinating flights (ie projects) - scheduling them, coordinating resources for them etc. While this might be a valid comparison, I think the changing face of software development is leaning towards taking road trips as oppose to long flights.

You may have noticed this blog has been awfully quiet in the past couple of months. That's because I've been working on a neat side project with a couple of other developers. Today, we'd like to submit our project to the ASP.NET community to get some feedback. The site is called WorkGrabber.com. You can check it out here: http://workgrabber.com

At first glance, upgrading to the RC1 was quite a debacle. First of all, any link that I created using the much more performant Html.RouteLink (instead of Html.ActionLink) just stopped working. It turns out there was a regression bug in the RC that caused this. The ASP.NET MVC team quickly released a refresh which fixed the problem.

First of all, an apology for being so quiet over the past few weeks. I've been putting my blogging aside for a while to chase some pet projects I'm working on. More on that later.

I did, however, run into a particular situation that I thought would be of interest to anyone adopting ASP.NET MVC and looking for some goodies from jQuery. Many of you have no doubt started testing the waters with jQuery since it was announced that Microsoft will be shipping the next version of .NET with it included. If you haven't used jQuery yet, prepare to fall in love!

In this post, I'm going to cover a simple way to build a deep, hierarchical and feature-rich tree structure with only one line of jQuery script. jQuery has a huge library of plugins covering all sorts of functionality. For this, we'll be using a neat plugin from for treeviews. Here's what you need:jQueryjQuery Treeview Plugin

This structure will consist of a category/sub-category relationship that is able to support n-levels of sub-categories with no changes. To demonstrate, let's look at the SQL table that supports the structure.Notice the rows with ParentCategoryID set to NULL are the parent categories. Each row with a ParentCategoryID is a sub-category and relates to it's parent category. The numbers show the level in outline view.

The jQuery Treeview plug-in requires the resulting HTML to be in a particular unordered list (<ul>) element to parse the tree correctly. Since we don't know how many levels to expect, we are going to call the MVC user control that renders each node recursively. This control accepts a single Category item.

I've been feverishly adapting and experimenting with the ASP.NET MVC Framework since the very first CTP. I must admit, it keeps getting better with every release. This past week was the official BETA release and I'm loving it.

It has been a challenge for developers new to the concepts of MVC to find reference samples to help architect MVC web applications. For this, I've suggested to look towards more mature MVC frameworks such as Ruby on Rails for common patterns in MVC applications. RoR is not difficult to read and you'll certainly be able to follow the program logic. I've HIGHLY recommend you take a look at this white paper exploring RESTFul Rails and then see how you can apply it to ASP.NET MVC.

I decided to write a second part to my previous post on extending the IQueryable interface to create a really neat and organized data access layer with Linq To Sql. The cool thing about this practice is that it nicely separates individual filters for integration testing and then lets you combine them to form much more complex queries.

Inspired by Rob Conery's great work on his MVC Storefront screencasts, I decided to look into his Pipes and Filters implementation and attempt to create my own. Although there was a lot of critical commentary on some of the design decisions, I found myself very intrigued by this fluent interface implementation. I haven't referenced back to the specific code samples so if it differs significantly, please keep in mind that this was certainly inspired by it.