MvcContrib - now with SubController support for ASP.NET MVC

I'm still hoping that SubControllers make it into the MVC Framework release, but my company is doing several client projects right now using the MVC Framework.  These projects are enterprise applications, not smaller websites, so subcontrollers are absolutely necessary to handle the complex logic and permissions.  I've create an implementation of subcontrollers and added it to MvcContrib.  It is pulling its weight on one client project, so I'm happy with it.  It can be made better, and I'm hoping the team can take my first draft and incorporate it into the product.

Matt Hinze has recently done a very nice write-up on his experience using MvcContrib SubControllers.  I also recommend subscribing to his blog.

Here is the revision that added SubController support to MvcContrib:

I have included a full sample with 3 levels of nested subcontrollers and an example of a nested subcontroller owning a form and posting to itself without the parent controllers caring:

Feel free to pull down the source and let me know what you think.  Even better, if you find an idea for improvement, please submit a patch.  I have leveraged the IModelBinder so that subcontrollers can be passed directly into action methods, and you can hook your IoC container up so that it creates the subcontrollers and the dependencies.  Decomposing complex screens infinitely increases maintainability, so this is why I consider subcontrollers a critical feature.  Even if this doesn't make it into the product, the team has done a good job making the framework extensible, so I was able to implement subcontrollers in less than 150 lines of code.   I welcome your thoughts and opinions. 

You can pull down the source for MvcContrib by pointing your TortoiseSVN client to Note that this is a SVN URL, not a web page URL


Dew Drop - September 20, 2008 | Alvin Ashcraft's Morning Dew Posted on 9.20.2008 at 9:17 AM

Pingback from Dew Drop - September 20, 2008 | Alvin Ashcraft's Morning Dew

Arjan`s World » LINKBLOG for September 21, 2008 Posted on 9.21.2008 at 2:14 PM

Pingback from Arjan`s World » LINKBLOG for September 21, 2008

Reflective Perspective - Chris Alcock » The Morning Brew #184 Posted on 9.22.2008 at 2:10 AM

Pingback from Reflective Perspective - Chris Alcock » The Morning Brew #184

ASP.NET MVC beta Posted on 10.17.2008 at 3:00 PM

The ASP.NET Model-View-Controller kit has finally gone into beta. Blog posts from Scott Guthrie , Scott


Simone said on 9.19.2008 at 11:05 AM

Subcontrollers are a must-have features, Partial Rendering is not what it's needed

Eric said on 9.20.2008 at 5:33 PM

What would be an actual use case for a sub-controller?

jammer said on 1.26.2009 at 4:26 PM

SubControllers is not as good as u thing

I asume its past long time ago