4 Answers, 1 is accepted
0
Brendon
Top achievements
Rank 1
answered on 12 Dec 2012, 03:21 AM
Ran into this same thing recently and found this somewhere (but not sure where)...There is a Kendo function you can use to format column fields in a ClientTemplate:
Full template example:
Column name is of course the bound column. If you still want to be able to sort on the field, add it as a bound column as well.
Hope that helps.
#=kendo.toString(ColumnName,'yyyy-MM-dd')#
Full template example:
columns.Template(@<
text
></
text
>).ClientTemplate("#=kendo.toString(ColumnName,'yyyy-MM-dd')#");
Column name is of course the bound column. If you still want to be able to sort on the field, add it as a bound column as well.
columns.Bound(e => e.ColumnName).Template(@<
text
></
text
>).ClientTemplate("#=kendo.toString(ColumnName,'yyyy-MM-dd')#");
0
Rachel
Top achievements
Rank 1
answered on 28 Jan 2015, 01:12 PM
Thank you so much! Hours saved..
1
Toby
Top achievements
Rank 1
answered on 05 Mar 2020, 02:25 PM
If the column is part of a detailgrid you will need to escape the '#' like below Hopefully this can save someone some time
columns.Bound(o => o.ReceiveDt).ClientTemplate("\\#= kendo.toString(kendo.parseDate(ReceiveDt),'MM/dd/yyyy hh:mm tt') \\#");
0
Hi Toby,
Thank you for sharing your knowledge with the community! More about the Hash literals escaping can be read on this article from our documentation.
Regards,
Petar
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.