This is a migrated thread and some comments may be shown as answers.
Kendo.MVC.dll Grid Date Format
1 Answer 486 Views
This is a migrated thread and some comments may be shown as answers.
Hesham Nabih
Top achievements
Rank 1
Hesham Nabih asked on 10 Jun 2012, 04:42 AM
Hi I am  using Kendo.MVC.dll:
In MS Sql (2012) table I have column:

    Day Data Type datetime

In the controller I get the data using"
 

      public ActionResult BloodPressure_Read([DataSourceRequest] DataSourceRequest request)
            {
             return Json(BPRepository.All().ToDataSourceResult(request));
            }

In the view:

    @(Html.Kendo().Grid<BPViewModel>()
    
        .Name("Grid")
        .Columns(columns =>
        columns.Bound(p => p.Day).Format("{0:d}");

The date is displayed as 1/1/2012; however when I edit it (using Ajax) it shows as Sun Jan 1 00:00:00 PST 2012!!  When I try to update the row, I get "Day is invalid Date.

Any idea how I can convert the date to yyyy,mm, dd?
Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Jun 2012, 07:12 AM
Hello Hesham,

Currently, specifying the format in which the Grid sends the dates is not supported. If you have set a specific culture on the server and the ModelBinder is unable to handle the date passed by the Grid, you should include the Kendo script file for that culture in order for the date to be passed in the correct format.
Regarding the format used when editing - it will depend on the editor template which is provided for the DateTime type.

Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Hesham Nabih
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or