This is a migrated thread and some comments may be shown as answers.

Date format is not working

4 Answers 587 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hash
Top achievements
Rank 1
hash asked on 13 Feb 2013, 10:53 PM
Hi all, 

Here is my kendo grid declaration in the cshtml

 columns: [
                    { field: "MemberFirstName", title: "Member<br/>First Name" },
                    { field: "MemberLastName", title: "Member<br/>Last Name" },
                    { field: "ClientMemberID", title: "Client<br/>Member ID" },
                    { field: "ProviderID", title: "Provider ID" },
                    { field: "ProviderFirstName", title: "Provider<br/>First Name" },
                    { field: "ProviderLastName", title: "Provider<br/>Last Name" },
                    { field: "AppointmentDate", title: "Appointment<br/>Date" }
                 ],
My last column is a date time column, i want to show only date value not the time. 

I can see the data that i am binding and its clearly a date time value, When i see it in the UI, i see it as /Date(1331166600000)/

any one had this issue before?

I tried the following ways

template: '#= kendo.toString(AppointmentDate,"dd MMMM yyyy") #' 
format: "{0:dd/MMMM/yyyy}"


None of the above two methods worked for me. 

4 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 14 Feb 2013, 08:29 AM
Hi,

 As you may know in order date to be formatted they should be a JavaScript Date instance. The DataSource will automatically convert the .NET Date literals, as the one you are using, if the field type is correctly described in the schema model definition. Therefore, please make sure you have such definition set.

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
hash
Top achievements
Rank 1
answered on 14 Feb 2013, 03:24 PM
My model is Entity framework object, do i have to define agian in the JavaScript? 

Where can i define it in the code i mentioned in the first post.
0
Accepted
Rosen
Telerik team
answered on 15 Feb 2013, 07:19 AM
Hi,

It appears from the snippet you have provided that you are using KendoUI Web and instantiating the Grid widget via JavaScript. In this case in order fields to be parsed to the specified type, you will need to described the Model in the schema declaration as I have already mention in my previous message. Please take a look at this online demo.

Greetings,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Francois Dumaine
Top achievements
Rank 1
answered on 21 Feb 2013, 03:59 PM
Rosen,

If you good see your documentation : http://demos.kendoui.com/web/grid/local-data.html

Go check the ASP.NET MVC. The grid sample and the code it's not the same.

Thank you

François Dumaine
Tags
Grid
Asked by
hash
Top achievements
Rank 1
Answers by
Rosen
Telerik team
hash
Top achievements
Rank 1
Francois Dumaine
Top achievements
Rank 1
Share this question
or