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

ModelBinder Doesn't Recognize Date

1 Answer 50 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
jwize
Top achievements
Rank 1
jwize asked on 22 Jul 2014, 09:00 AM
Can't Send Start/End Date to Server

When, I save my event the start and end dates don't get posted to the server. I can override the save event and do something like this. 
e.event.start = kendo.toString(e.event.start, "u"); The values are then saved and the records it successfully added to the database.

Why does this happen? 

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 24 Jul 2014, 06:02 AM
Hi Jaime,

Basically you should use "parameterMap" function of the dataSource transport in order to stringify the current record correctly. Please check the example below:

dataSource: {
    transport: {
        read: {
            url: "Home/Meetings_Read",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            type: "POST"
        },
        update: {
            url: "Home/Meetings_Update",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            type: "POST"
        },
        create: {
            url: "Home/Meetings_Create",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            type: "POST"
        },
        destroy: {
            url: "Home/Meetings_Destroy",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            type: "POST"
        },
        parameterMap: function (options, operation) {
            if (operation === "read") {
                var scheduler = $("#scheduler").data("kendoScheduler");
                var result = {
                    start: scheduler.view().startDate(),
                    end: scheduler.view().endDate()
                }
                return kendo.stringify(result);
            }
            return kendo.stringify(options);
        }
    },

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
jwize
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or