I have changed the REST sample to edit date times although
1. I added in the Customer a Date Field
public Customer(Northwind.Customer c) { this.CustomerID = c.CustomerID; this.CompanyName = c.CompanyName; this.ContactName = c.ContactName; this.Address = c.Address; this.City = c.City; this.Orders = new List<Order>(); this.Date = DateTime.Today; }
2. I added in the RestEditing.aspx the Column for editing.
column.For(x => x.Date).HeaderText("Date").DataType("date");
3. Then I went I set a breakpoint into UpdateCustomer
[HttpPut] public void UpdateCustomer(Infragistics.Web.Mvc.Samples.Models.Customer customer)
and discovered that the Date isn't set in the Rest operation.
I changed the Field to string and saw that this value is in the field.
Date = "/Date(1383782400000)/"
Is this a Bug or what can I do to enable REST with the jquery Grid for Dates.
Thanks in advance
Thomas Stocker
Thanks a lot
This did the trick
Hi Thomas,
There is a known problem that JsonValueProviderFactory (which is used by default in MVC 3) is not handling dates correctly sometimes (Example: here), so this is not a problem of the igGrid REST support implementation.
The easiest way to workaround the problem is to replace JsonValueProviderFactory with Newtonsoft JSON serializer (which is included in MVC 4 as a default JSON serializer/deserializer). You can see how to do that here and here.
This problem doesn't exists when you use the MVC 4 project, because it already uses Newtonsoft.Json.dll by default.
If you don't want to change default JSON serializer then you can implement your custom model binder.
Hope this helps,
Martin Pavlov
Infragistics, Inc.
Is it necessary for this to file a Bug?