MVC Binding blank textbox into SmartDate property

MVC Binding blank textbox into SmartDate property

Old forum URL:

bdivsalar posted on Friday, April 09, 2010

Dear All,

I wondered if you can help me please on my ASP.Net MVC 1.0 application where I want to bind a null smartdate into database.

I am using CslaContrib.Mvc and DefaultCslaModelBinder.cs to bind the view into model. I have got a datetime text box using below code in the view :


= Html.TextBox("DisposalDate", instrument.DisposalDate, new { @class="datepicker" })%>


instrument.DisposalDate is as type of SmartDate in the instrument model. If I leave the textbox empty, I will get an error in the modelState just after TryUpdateModel says, "A value is required" for DisposalDate property where I am assuming SmartDate could be set to null and then it will be saved as null in the database.

Just to clarify, I am using MVC 1.0 and Csla modelbinder from CslaContrib.Mvc namespace. Please let me know if there is any newer version and where I can download.

Could someone please let me know how I can change this behaviour in the BindCslaModel.


Best Regards

Behnam Divsalar



bniemyjski replied on Tuesday, May 04, 2010


Is there any chance you could attach a small sample application so we could debug this locally.


-Blake Niemyjski

Copyright (c) Marimer LLC