Hi,
This question and example actually applies to the Grid but since it is about the DataSource I'm posting it in the General Area.
As you can see below I'm using a read action for my Ajax request. And also using the Data method to provide the action with Data.
When I only provide string or integer types in the return function (AdditionalData) everything is fine. But when I want to use a Date (i.e. StartDate, EndDate), the properties StartDate and EndDate are not passed to the Action Controller and the Action cannot be found (because the parameters do not match, I think).
Is there a simple way to pass a Date object to your Action Controller or not to use the .Read(.. method but a jQuery ajax request?
Kind regards,
Lennart
Grid Definition:
@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view
.Name("Grid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HistoryDowntimes_Read", "TimeRegistration").Data("AdditionalData")))
.Columns(columns =>
{
columns.Bound(p => p.TimeEventID);
....
Data Return Function:
function AdditionalData() {
return {
LocationID: 8,
StartDate: new Date(2012, 1, 1, 11, 42, 30, 477),
EndDate: new Date(2013, 1, 1, 11, 42, 30, 477)
};
}
==> Fixed LocationID and Date is for Development purposes only.
This question and example actually applies to the Grid but since it is about the DataSource I'm posting it in the General Area.
As you can see below I'm using a read action for my Ajax request. And also using the Data method to provide the action with Data.
When I only provide string or integer types in the return function (AdditionalData) everything is fine. But when I want to use a Date (i.e. StartDate, EndDate), the properties StartDate and EndDate are not passed to the Action Controller and the Action cannot be found (because the parameters do not match, I think).
Is there a simple way to pass a Date object to your Action Controller or not to use the .Read(.. method but a jQuery ajax request?
Kind regards,
Lennart
Grid Definition:
@(Html.Kendo().Grid(Model) // Bind the grid to the Model property of the view
.Name("Grid")
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("HistoryDowntimes_Read", "TimeRegistration").Data("AdditionalData")))
.Columns(columns =>
{
columns.Bound(p => p.TimeEventID);
....
Data Return Function:
function AdditionalData() {
return {
LocationID: 8,
StartDate: new Date(2012, 1, 1, 11, 42, 30, 477),
EndDate: new Date(2013, 1, 1, 11, 42, 30, 477)
};
}
==> Fixed LocationID and Date is for Development purposes only.