views:

184

answers:

1

I'm trying to build a "New Customer" form, so I'm using the default model binder to build my Customer object:

public ActionResult New(Customer customer) { ... }

The only problem is I have a few properties on the Customer object that aren't required. When I leave these fields blank, ASP.NET MVC automatically throws up model errors stating "A value is required".

How can I signal to the framework that these properties are optional?

+6  A: 

I'm not 100% but making them nullable should work.

Chad Moran
Though so, not in front of a computer I could check the validity though.
Chad Moran