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

[Solved] Date Format in Ajax

1 Answer 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ofer
Top achievements
Rank 1
Ofer asked on 11 Jan 2012, 03:52 PM
Using version: 2011.1.414

Dear Telerik,
I have a ViewModel with a DateTime Field, called "UpdateDate".
In my Grid, I use server side and ajax databound (so the first time the grid is initialized the data will be serve from the server, 
and on sorting will continue with ajax binding).
The data loads fine on the server binding, and my date format {0:MM.dd.yyyy}, works fine.
But when I press the header in one of the columns for sorting, the DateTime changes, ignores the format and shows the entire DateTime.

  Cols.Bound(Col => Col.UpdateDate)
          .Format("{0:MM.dd.yyyy}")
      .Title("UpdateDate")
      .Width("16%");
 
})
 .DataBinding(data => data.Ajax().Select("_Docs_AjaxBind", "Tik", new RouteValueDictionary { { "TikId", ViewData["TikId"] }, { "DocId", ViewData["DocId"] } })


In your documentation I didn't see any regard to this case, saying Ajax doesn't support DateTime format.
Am I missing something in my understanding ?

Sincerely yours,
Ofer Levy

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 12 Jan 2012, 09:08 AM
Hi Ofer,

The DateTime formatting is working fine on my side using the setup you described (on initial load and when ajax sorting is applied the formatting remains the same). Could you please share a sample project which reproduces the behavior so we can investigate further what causes it?

Kind regards,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
Ofer
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or