I have a grid that is working well, except that I am unable to create or update a row that contains a date.
On the back-end, my model class looks like this:
In my MVC cshtml file I have:
I would think that with this code that the data source would not try to pass the CreateDate field at all to the server, since it is read only. This appears not to be the case and it passes something that MVC doesn't understand such as "Wed Mar 27 2013 16:41:40 GMT-0400 (Eastern Daylight Time)." How do I prevent it from sending this value?
On the back-end, my model class looks like this:
public
class
Model
{
public
Model() {
this
.CreateDate = DateTime.UtcNow;
}
// Other properties
public
DateTime CreateDate {
get
;
private
set
; }
}
In my MVC cshtml file I have:
// Other setup...
.DataSource(ds =>
ds.Ajax()
.Model(model =>
{
model.Id(o => o.Id);
model.Field(m => m.CreateDate).Editable(false);
})
// more...
I would think that with this code that the data source would not try to pass the CreateDate field at all to the server, since it is read only. This appears not to be the case and it passes something that MVC doesn't understand such as "Wed Mar 27 2013 16:41:40 GMT-0400 (Eastern Daylight Time)." How do I prevent it from sending this value?