I want to build a Kendo UI Grid with format date dd//MM/yyyy. However, all questions that I found about this, it were resolved with code Format("{0:d}");. So, I have tried like a code below:
GridBoundColumnBuilder<TModel> builder = par.Bound(field.Name); switch (field.Type.Type) { case CType.Boolean: builder = builder.ClientTemplate(string.Format("<input type='checkbox' #= {0} ? checked='checked' : '' # disabled='disabled' ></input>", field.Name)); break; case CType.Datetime: builder = builder.Format("{0:d}"); break; case CType.Decimal: case CType.Double: builder = builder.Format("{0:0.00}"); break; }
Another formats is works fine, just DateTime do not works.
I had this result for Datetime = /Date(1377020142000)/
{ field: "DOR", title: "Release Date", format: "{0:MM/dd/yyyy}", }, { field: "rating", title: "Rating" }, { command: ["edit", "destroy"], title: " ", width: "250px" }
The Kendo UI grid is a powerful widget which allows you to visualize and edit data via its table representation. It provides a variety of options about how to present and perform operations over the underlying data, such as paging, sorting, filtering, grouping, editing, etc.
If you want to display datetime format in kendo grid then do this,
.Format("{0:dd/MM/yyyy}")
Or
builder.ToString("dd/MM/yyyy");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With