剑道日期选择器 - 单击网格更新时,日期时间值将增加1

时间:2014-06-16 11:52:51

标签: c# datetime kendo-ui kendo-grid kendo-datepicker

我在Kendo Grid的内联编辑中使用了剑道日期选择器。

如果我选择一个值,点击更新时,所选值为(选定值)+1。它只在我将代码部署到服务器时才会发生。在我的localhost中无法重现

点击更新后,我有以下代码

public ActionResult Update([DataSourceRequest] DataSourceRequest request)
    {
        CompanyPrepaymentException PPEx = new CompanyPrepaymentException();
        try
        {

            TryUpdateModel(PPEx); // this gets value from current context, the selected data and other required properties

               //some logic


                if (ModelState.IsValid == true)
                {


                    if (prepayException != null)
                    {
                        prepayException.StartDate = PPEx.StartDate;
                        prepayException.EndDate = PPEx.EndDate;

                    }

                }
            }



        catch (Exception ex)
        {

           //catch block
        }

        return Json(new[] { prepayException }.ToDataSourceResult(request, ModelState));

    }

1 个答案:

答案 0 :(得分:0)

我将文化信息设置为默认(en-US)和解析日期,它工作正常

System.Globalization.CultureInfo cultureinfo =
     new System.Globalization.CultureInfo("en-US");
    prepayException.StartDate = DateTime.Parse(PPEx.StartDate.ToString(), cultureinfo);
 prepayException.EndDate = DateTime.Parse(PPEx.EndDate.ToString(), cultureinfo);