0

我在剑道网格的内联编辑中使用剑道日期选择器。

如果我选择一个值,点击 update ,选择的值是(选择的值)+1。仅当我将代码部署到服务器时才会发生这种情况。在我的本地主机中无法重现

单击更新时,我有以下代码

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));

    }
4

1 回答 1

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);
于 2014-06-17T09:28:08.897 回答