Display only datepicker in kendo inline editing no

2019-06-21 23:22发布

问题:

I have an issue to disply the datepicker in kendo inline editing. It shows datetime picker all the times.

columns.Bound(k => k.datefrom).ClientTemplate("#= (datefrom == null) ? ' ' : kendo.toString(datefrom, 'dd.MM.yyyy') #").Width(150);

I also tried like this also

columns.Bound(k => k.datefrom).ClientTemplate("#= (datefrom == null) ? ' ' : kendo.toString(datefrom, 'dd.MM.yyyy') #").Format("{0:d}").Width(150); 

Any idea?

回答1:

You need to specify the Model Property strictly to Date in View model using Data Annotations. In your view model,

[DataType(DataType.Date)] // making data type as date     
public Nullable<System.DateTime> datefrom { get; set; }

And in Kendo Grid,

columns.Bound(k => k.datefrom).Format("{0:dd.MM.yyyy}")

It works now :)