I'm having problems when trying to format the date that's displayed on a grid.
With the following code:
The date appears unformatted (e.g. /Date(1361292162723)/) and the edit button appears in the other column (see the edit image).
If I change the code so that the date column uses a client template with the date formatting:
Then the date formats correctly but the edit button in the other column no longer appears. It just shows the ID as a string (see the noedit image).
How can I get the date to format correctly and have the other client template working?
With the following code:
@(Html.Kendo().Grid(Model.Users) .Name("Grid") .Columns(columns => { columns.Bound(u => u.UserView.CreatedOn).Format("{0:g}"); columns.Bound(u => u.UserView.ID).Title("").Sortable(false).Width(100) .ClientTemplate("<a class='button' href='" + Url.Action("EditUser", "Admin") + "/#= UserView.ID #'" + ">Edit</a>" ); }) .Pageable() .Sortable() .Scrollable(scr => scr.Height(400)) .Resizable(resize => resize.Columns(true)) .DataSource(dataSource => dataSource.Ajax().ServerOperation(false)))If I change the code so that the date column uses a client template with the date formatting:
@(Html.Kendo().Grid(Model.Users) .Name("Grid") .Columns(columns => { columns.Bound(u => u.UserView.CreatedOn).ClientTemplate("#=CreatedOn ? kendo.format('{0:d}', kendo.parseDate(CreatedOn)) : ''#"); columns.Bound(u => u.UserView.ID).Title("").Sortable(false).Width(100) .ClientTemplate("<a class='button' href='" + Url.Action("EditUser", "Admin") + "/#= UserView.ID #'" + ">Edit</a>" ); }) .Pageable() .Sortable() .Scrollable(scr => scr.Height(400)) .Resizable(resize => resize.Columns(true)) .DataSource(dataSource => dataSource.Ajax().ServerOperation(false)))How can I get the date to format correctly and have the other client template working?