Reputation: 23
i have using inline editing in mvc datagrid. when i select edit for editing record TimePicker value is null.
**In Grid**
columns.Bound(p=>p.TimeRequired).EditorTemplateName("GridTimePicker").Title("Time");**
**Editor Template (GridTimePicker.cshtml):**
@model DateTime?
@(
Html.Kendo().TimePickerFor(m=>m).Name("GridTimePicker").Interval(15)
)
how to solve this problem? thanks in advance.
Upvotes: 0
Views: 2367
Reputation: 1193
****Editor Template*******
@model DateTime?
@(Html.Kendo().DatePicker()
.Name("TimeRequired") //name should be same as property
.Value(Model == null ? DateTime.Now.Date : ((DateTime)@Model).Date)
)
***************Grid*******
// will print the date in "28/01/2014" style...
columns.Bound(p=>p.TimeRequired).EditorTemplateName("GridTimePicker").Title("Time")
.ClientTemplate("#= kendo.toString(TimeRequired,'d') #")
regards
Upvotes: 0
Reputation: 30661
You should not set the Name()
when using TimePickerFor
:
@(Html.Kendo().TimePickerFor(m=>m).Interval(15))
Upvotes: 2