Search code examples
asp.netdynamic-data

DateTime in the dynamic data framework


I am using the Dynamic Data framework with scaffolding. Quite nice for a small home database that I am creating.

I notice though that if I create a field in the database of type 'date' (not datetime) the value is shown in the dynamic data site as a datetime. i.e. as this,

1/1/2010 12:00am

I just want it to display 1/1/2010 as the underlying data type is just a date, and I have no need to store times too.

I have the scaffolding set up, is there some kind of attribute I can use to specify the format?


Solution

  • Use DataTypeAttribute(DataType.Date) as your property metadata annotation.