I am trying to use a datepicker in a grid column that utilizes InCell editing. The problem I am having is that the datepicker appears to revert back to the specified default value after I remove the focus from the datepicker cell into another cell. Another interesting thing to note is that I can click back into the datepicker cell that I changed and the datepicker will once again show the correct date that I changed the cell too. Any ideas what causes this behavior?
Here is the date snippet from my viewmodel:
[DisplayName("Month/Year")][DisplayFormat(DataFormatString = "{0:MMMM yyyy}")][DataType(DataType.Date)][Required]public DateTime FOBDate { get; set; }
Here is my Date.cshtml code:
@model DateTime?@(Html.Kendo().DatePickerFor(m => m) .Name("fobpricedate") .Format("MMMM yyyy") .Start(CalendarView.Year) .Depth(CalendarView.Year))
And here is my view that contains the grid:
@(Html.Kendo().Grid<TestMACPortal.Models.FOBViewModel>() .Name("grid") .Columns(columns => { columns.Bound(c => c.Category).ClientTemplate("#=Category.CategoryName#"); //.EditorTemplateName("ProductCategory"); columns.Bound(c => c.SKU_Name); columns.Bound(c => c.MaterialNumber); columns.Bound(c => c.Company).ClientTemplate("#=Company.CompanyName#"); columns.Bound(c => c.FOBDate).EditorTemplateName("Date"); columns.Bound(c => c.Price).EditorTemplateName("Price"); }) .ToolBar(toolbar => { toolbar.Create(); //toolbar.Save(); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .HtmlAttributes(new { style = "height: 500px;" }) .Scrollable() .Sortable() .Groupable() .Resizable(resize => resize.Columns(true)) //.Filterable(ftb => ftb.Mode(GridFilterMode.Row)) .DataSource(dataSource => dataSource .Ajax() .Batch(true) .ServerOperation(false) .Events(events => events.Error("error_handler")) .Model(model => { model.Id(c => c.FOBID); model.Field(c => c.FOBID).Editable(false); model.Field(c => c.Category).DefaultValue(ViewData["defaultCategory"] as TestMACPortal.Models.ProductCategoryViewModel); model.Field(c => c.Company).DefaultValue(ViewData["defaultCompany"] as TestMACPortal.Models.CompanyViewModel); model.Field(c => c.FOBDate).DefaultValue(DateTime.Today); }) //.Destroy("Editing_Destroy", "FOB") .Read(read => { read.Action("GetFOBs", "FOB"); }) //.Create("CreateFOB", "FOB") //.Update("UpdateFOB", "FOB") ) )