Mathias Van Houtte
Mathias Van Houtte

Reputation: 200

Kendo UI MVC Grid I cannot use a datepicker while editing

I got a grid where I want to display data but for some reason I cannot use the datepicker when I want to edit my datetime field. I tried using the EditorTemplateName but I get some old fashion timepicker without the date filled in.

Old fashion datepicker when using editortemplate

I would like to have a datepicker that looks like this

Anyone that has experience with this?

Upvotes: 1

Views: 7220

Answers (2)

Mathias Van Houtte
Mathias Van Houtte

Reputation: 200

I found the solution. It seems that you need to add generic cshtml files. I added a folder to my shared folder (mandatory it's the shared folder) and I added the class "Date.cshtml".

Date.cshtml

@model DateTime?

@(Html.Kendo().DatePickerFor(m => m).Format("dd/MM/yyyy"))

In your grid you can reference to this editortemplate

columns.Bound(x => x.DisplayDate).Format("{0:dd/MM/yyyy}").EditorTemplateName("Date")

Upvotes: 7

Sean
Sean

Reputation: 21

I have not done what you are attempting with the MVC wrappers, but I have done it client side. Check out this JS Bin and perhaps it will help you configure your column editor templates.

JS Bin showing client side configuration of datetime column editor

Upvotes: 2

Related Questions