Default Empty value in Kendo DatePicker

chamara picture chamara · Dec 30, 2013 · Viewed 28.3k times · Source

I need the default value of datetime picker to be empty.

@(Html.Kendo().DatePickerFor(model => model.RevisionDate)
              .Name("RevisionDate")
                )

"RevisionDate" is a datetime property in a asp.net mvc model.

how it's currently being displayed

enter image description here

and i need to display it as below

enter image description here

Answer

Atanas Korchev picture Atanas Korchev · Dec 30, 2013

Your RevisionDate property is by default set to DateTime.MinValue which is 01/01/0001 ( all DateTime properties behave like that). This is why the Kendo UI DatePicker shows it like that. The solution is to make the property a nullable DateTime (DateTime?) whose default value is null.