Using MulticolumnComobox attempting to format a datetime? field (Telerik.MVC 2022.3.1109)

2 Answers 141 Views
MultiColumnComboBox
Doug
Top achievements
Rank 1
Doug asked on 25 Jan 2023, 05:04 PM

I've tried a multitude of options, but the ones that don't throw errors, I get "/Date(16400...." as the results

Here are some of the tries.

columns.Add().Field("StartDate").Title("Start Date").Template("#:kendo.toString(StartDate,'MM/dd/yyyy')#").Width("150px");

columns.Add().Field("StartDate").Title("Start Date").Template("#:data.StartDate.ToString('MM/dd/yyyy')#").Width("150px");

columns.Add().Field("StartDate").Title("Start Date").Template("#= kendo.toString(StartDate, 'MM/dd/yyyy')#").Width("150px");

 

I did see the one user voice asking for a "Format" method for MCCB as getting the escape correct is difficult but didn't give any examples.

using Telerik.MVC 2022.3.1109

2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 30 Jan 2023, 09:56 AM

Hi Doug,

 

Thank you for contacting us about this matter.

Can you try the .ClientTemplate instead of the server .Template and see if this resolves the issue? You can also try using the .Format() property directly:
https://stackoverflow.com/questions/52743857/kendo-grid-showing-datetime-as-date

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Doug
Top achievements
Rank 1
commented on 30 Jan 2023, 01:24 PM

Only options are HeaderTemplate and Template, clienttemplate does exist in columnbuilder.   Actual message "CS1061 MultiColumnComboBoxColumnBuilder does not contain a definition for 'clienttemplate' and no accessible extension method"
0
Eyup
Telerik team
answered on 02 Feb 2023, 01:04 PM

Hi Doug,

 

Yeah, you are correct. Sorry for that syntax mistake. Here is the proper configuration:

 columns.Add().Field("OrderDate").Title("OrderDate").Template("#= kendo.toString(kendo.parseDate(OrderDate, 'M/d/yyyy h:mm:ss tt'), 'M/d/yyyy h:mm:ss tt') #");
Try to use this approach -#= ... #

And the Date is displayed as expected:

I have also prepared a sample MVC project for demonstration. Feel free to run it and let me know if it helps you.

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
MultiColumnComboBox
Asked by
Doug
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or