This project is read-only.

What Is it?

MvcImproved tries to add some things that are missing in MVC, including but not limited to:
  • Typesafe MVC controls, based on the type of the Model and its members
    • Repeater
    • CheckBox
    • Literal
  • An improved DefaultModelBinder which binds more smartly to List<> and Dictionary<>, not requiring index succession. Additionaly, Dictionary<> will now parse the key value of the form parameter.


  • Faster - Instead of doing string lookups in dictionaries to get a member value, Lamda expressions are used
  • Safer - Type safety will blow up during compile time instead of runtime (but you must enable MvcBuildViews)

Installation Instructions


Given the following model:
namespace MvcImprovedTest.Models
	public class ProductExtra
		public string ExtraInfo1;
		public string ExtraInfo2;

	public class Product
		public long ID;
		public string Name;
		public List<ProductExtra> Extra;

We can define an ASPX page as follows:
<%@ Page Language="C#" Inherits="MvcImproved.Generic.ViewPage" ModelType="MvcImprovedTest.Models.Product" MasterPageFile="~/Views/Shared/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<h2>Simple Product Test 2 - Using ModelType instead of generic declaration</h2>

	<mvcg:Literal runat="server" ValueMember="Name" />

	<mvcg:Repeater runat="server" ValueMember="Extra">
			<span>Info 1: <mvcg:Literal runat="server" ValueMember="ExtraInfo1" /></span>
			<span>Info 2: <mvcg:Literal runat="server" ValueMember="ExtraInfo2" /></span>


Which will give us the following Intellisense:
Intellisense Sample

Designer Mode

One of the greatest advantagtes to using controls instead of <% %> tags is their visibility in design mode.
Design Mode Sample

More Samples

Write Your Own Type-Safe Control

Future Work

Currently, only a handful of controls are implemented as generic type-safe controls. The most important part, however (parsing of generic controls) is complete.

A list of TODO's:
  • More controls (TextBox, RadioButton, etc.)
  • At some later date, a custom PageParser that better handles generic types

Because of ASP.NET's poor and buggy implementation of the ControlBuilder classes, some of the code is quite hacky. Hopefully in the near future there will be better support for custom page and control builders, and better support for generics.

Your contribution is requested and welcomed!

Last edited Aug 24, 2009 at 8:02 PM by marquinhocb, version 34