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

Batch editing grid, Date Format

1 Answer 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sebastian
Top achievements
Rank 1
Sebastian asked on 31 Oct 2012, 06:52 PM
Hello,

actually im facing a really bad problem with the kendo grid. I built a grid with batch editing, like shown in the kendo docs. The date is shown well in the normal display mode in the format i set {0:y} which displays month and year.
To edit this field, i use the Kendo Date Picker (this doest matter at all). So when the grid switches to edit mode, the date is not formatted and instead shown in the format "Mon Oct 01 2012 00:00:00 GMT+0200". I cant submit it in this format, because my validator gives me an error.

As i already spent hours on searching on that topic, i found a few things which acutally dont work for me. I set up the localized js files properly:
 @{
     var culture = System.Threading.Thread.CurrentThread.CurrentCulture.ToString();
   }

<
script src="@Url.Content("~/Scripts/cultures/kendo.culture." + culture + ".min.js")")</script>
<script>kendo.culture("@culture");</script>

As i can see in the display mode, the date is well formatted to the spanish format, which is my culture. So this works.

Maybe another info is, how my Data Class looks like (i tried as well with datatype datetime):
[DataType(DataType.Date)]
[DisplayFormat(ApplyFormatInEditMode=true, DataFormatString="{0:y}")]
public DateTime Date { get; set; }

So im kind of lost, what the problem is. I also tried the ClientTemplate Property, but this is only called when the grid is in display mode.

King regards

1 Answer, 1 is accepted

Sort by
0
Sebastian
Top achievements
Rank 1
answered on 03 Nov 2012, 04:58 PM
I just installed the new version, and voilĂ  fixed! Nice!
Tags
Grid
Asked by
Sebastian
Top achievements
Rank 1
Answers by
Sebastian
Top achievements
Rank 1
Share this question
or