Hi there,
I have a kendo grid which binds into a datatable (it has to bind into a datatable as I do not know which columns i am expecting)
It seems like when binding a grid to a datatable, date columns are not being recognized as dates, and rendered as strings. So no filtering, sorting or formatting, and the date is being displayed in the json string format: /Date(1348489271318)/
The mark up is as follows:
@{ Html.Kendo().Grid(Model.GridModel)
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.GridModel.Columns)
{
var c = columns.Bound(column.DataType, column.ColumnName).Title(column.Caption);
if (column.ColumnName == "DateAdded")
{
c.Format("{0:dd/MM/yyyy hh:mm}");
}
}
})
Once I change the datasource into a class model, then everything works fine, the dates are rendered as dates with the correct format, filtering and sorting.
Any ideas why column of datatype date is getting rendered as a string?
Thanks
N
I have a kendo grid which binds into a datatable (it has to bind into a datatable as I do not know which columns i am expecting)
It seems like when binding a grid to a datatable, date columns are not being recognized as dates, and rendered as strings. So no filtering, sorting or formatting, and the date is being displayed in the json string format: /Date(1348489271318)/
The mark up is as follows:
@{ Html.Kendo().Grid(Model.GridModel)
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.GridModel.Columns)
{
var c = columns.Bound(column.DataType, column.ColumnName).Title(column.Caption);
if (column.ColumnName == "DateAdded")
{
c.Format("{0:dd/MM/yyyy hh:mm}");
}
}
})
Once I change the datasource into a class model, then everything works fine, the dates are rendered as dates with the correct format, filtering and sorting.
Any ideas why column of datatype date is getting rendered as a string?
Thanks
N