Search code examples
kendo-uitelerikkendo-gridkendo-asp.net-mvc

Kendo UI Grid MVC - Batch inline editing - Datepicker not displayed for DateTime field


I am using the MVC Kendo Grid with 4 columns, one of them is a DateTime field. The grid allows inline and batch editing. When I click on a Boolean field, it shows a checkbox. If I click on a text field, it displays a TextField. I would guess that for a date field, it should show a DatePicker. Instead it shows a TextField.

Here is the column declaration on the grid:

@(Html.Kendo().Grid<MyModel>()
            .Name("Grid")
            .Columns(columns =>
            {
columns.Bound(e => e.MyDate).Format("{0:dd.MM.yyyy}").Title("Date");
})
.Editable(x => x.Mode(GridEditMode.InCell))
.Batch(true)

Here is my model property:

[DataType(DataType.DateTime)] // making data type as date     
public DateTime? MyDate{ get; set; }

What am I missing? My only guess at this point is a missing .js file or something? Please let me know. Thanks!


Solution

  • You have to add editor templates for same. You can get below all the editor templates from Kendo site or from demo.

    enter image description here

    Date.cshtml

    @model DateTime?
    
    @(Html.Kendo().DatePickerFor(m => m))
    

    Let me know if any concern.