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
and i need to display it as below
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
.
If you don't want to make the property nullable, you can also do it like this:
@(Html.Kendo().DatePickerFor(m => m.Property).HtmlAttributes(new { value = "" }))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With