Detail Grid Date Format is Ignored

3 posts, 0 answers
  1. Richard
    Richard avatar
    9 posts
    Member since:
    Feb 2013

    Posted 04 Mar 2013 Link to this post

    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. Frank
    Frank avatar
    2 posts
    Member since:
    Nov 2011

    Posted 22 Sep 2015 Link to this post

    Any solution  for that?
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 24 Sep 2015 Link to this post

    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
Back to Top