This is a migrated thread and some comments may be shown as answers.

Detail Grid Date Format is Ignored

2 Answers 191 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 04 Mar 2013, 10:21 PM
I have a hierarchical grid which is rendering fine except that the date formatting for the detail grid is being ignored and a JSON date is being rendered instead.  The same formatting works fine in the Master grid.  Data for the sub-grid comes from a List collection in the object that populates the master.  The data was returned as one List of objects.

The detail grid renders
/Date(-62135568000000)/
instead of something like
01/23/2013 04:43 PM
Here's the code:
@model IEnumerable<KUI_CS_Test1.ROAMHostSvc.BatchHeader>
 
@{
    ViewBag.Title = "Kendo UI for MVC (C#) Test App";
}
 
<h2>Batch List</h2>
@(Html.Kendo().Grid(Model)
    .Name("batchGrid")
    .Sortable()
    .Pageable()
    .Filterable()
    .Columns(columns =>
        {
            columns.Bound(b => b.BatchID)
                                    .Width("200");
            columns.Bound(b => b.Transmitted_DateTime)
                                    .Width("15")
                                    .Format("{0:MM/dd/yyyy hh:mm tt}")
                                    .Title("Transmitted");
            columns.Bound(b => b.Completed_DateTime)
                                    .Width("15")
                                    .Format("{0:MM/dd/yyyy hh:mm tt}")
                                    .Title("Completed");
            columns.Bound(b => b.Created_DTTM)
                                    .Width("15")
                                    .Format("{0:MM/dd/yyyy hh:mm tt}")
                                    .Title("Created");
            columns.Bound(b => b.Created_Emp_Name)
                                    .Width("18")
                                    .Title("Created By");
        }
    )
    .ClientDetailTemplateId("transactions")
    .Events(e => e.DetailInit("detailInit"))
    .DataSource(dataSource => dataSource
    .Ajax()
    .Read(read => read.Action("FetchBatchList2", "Home"))
    )
)
 
<script id="transactions" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<KUI_CS_Test1.ROAMHostSvc.TransactionBase>()
                    .Name("Transactions_#=BatchID#")
                    .Columns( columns =>
                    {
                        columns.Bound(t => t.ID)
                                                .Width("200")
                                                .Title("Transaction ID");
                        columns.Bound(t => t.Version)
                                                .Width("10")
                                                .Title("Version");
                        columns.Bound(t => t.TranTypeDisplayText)
                                                .Width("15")
                                                .Title("Tran Type");
                        columns.Bound(t => t.PostingFlagDisplayText)
                                                .Width("15")
                                                .Title("Posting Flag");
                        columns.Bound(t => t.Posting_DTTM)
                                                .Width("15")
                                                .Format("{0:MM/dd/yyyy hh:mm tt}")
                                                .Title("Posting Date/Time");
                        columns.Bound(t => t.PostingMessage)
                                                .Width("300")
                                                .Title("Posting Message");
                    })
                    .ToClientTemplate()
    )
</script>
 
<script type="text/javascript" language="javascript">
    function detailInit(e) {
        var grid = $("#Transactions_" + e.data.BatchID).data("kendoGrid");
        grid.dataSource.data(e.data.TranCollection);
    }
</script>

2 Answers, 1 is accepted

Sort by
0
Frank
Top achievements
Rank 1
answered on 22 Sep 2015, 10:09 PM
Any solution  for that?
0
Boyan Dimitrov
Telerik team
answered on 24 Sep 2015, 02:25 PM

Hello Frank,

 

It seems that model property is not defined as DateTime, but as string. If it is defined as DateTime type the value should be parsed and shown properly. 

 

Regards,
Boyan Dimitrov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Frank
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or