We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Javascript error when trying to return data for a schedule

Thread ID:





128818 Feb 10,2017 04:34 PM UTC Feb 13,2017 06:05 AM UTC ASP.NET MVC 1
Tags: Schedule
Cornel Amarandei
Asked On February 10, 2017 04:34 PM UTC


I have this error when trying to return data for a schedule: "Uncaught TypeError: Cannot read property 'StartTime' of undefined" in ej.web.all.min.js.

My controller action looks like this:

public JsonResult Batch(EditParams param)
            var data = new List<ScheduleData>();
            data.Add(new ScheduleData() { Subject = "Testing", StartTime = DateTime.Now, EndTime = DateTime.Now.AddDays(3), AllDay = true, Owner = 1 });
            return Json(data.AsEnumerable(), JsonRequestBehavior.AllowGet);

The class ScheduleData looks like this:

public class ScheduleData
        public int Id;

        public string Subject;

        public string Location;

        public System.DateTime StartTime;

        public System.DateTime EndTime;

        public string Description;

        public System.Nullable<int> Owner;

        public System.Nullable<int> Priority;

        public System.Nullable<byte> Recurrence;
        public string Categorize;
        public System.Nullable<bool> AllDay;        

And the Schedule code is this:

    .Resources(res => { res.Field("OwnerId").Title("Owner").Name("Owners").AllowMultiple(true).ResourceSettings(flds => flds.Datasource((IEnumerable<object>)ViewBag.Owners).Text("text").Id("id").Color("color")).Add(); })
    .Group(gr => { gr.Resources(ViewBag.Resources); })
    //.AppointmentSettings(fields => fields.Datasource(ViewBag.datasource)
    .AppointmentSettings(fields => fields.Datasource(ds => ds.URL("/Projects/GetData").CrudURL("/Projects/Batch"))

The error comes after I try to insert a new appoitment, so after the return from the Batch action.

Thank you!

Karthigeyan Krishnamurthi [Syncfusion]
Replied On February 13, 2017 06:05 AM UTC

Hi Cornel,   
Thank you for contacting Syncfusion Support.   
We suspect that appointment was not saved properly in database, which could have caused the issue. We have prepared a CRUD sample with the provided code example, which can be downloaded from:   
In the above sample, when an appointment is added/edited/deleted, it will be reflected in the database too. Kindly refer to the below code example used in the sample.   
public JsonResult Batch(EditParams param) 
            if (param.action == "insert" || (param.action == "batch" && param.added != null))          // this block of code will execute while inserting the appointments 
            if (param.action == "remove" || param.deleted != null)                                        // this block of code will execute while removing the appointment 
            if ((param.action == "batch" && param.changed != null) || param.action == "update")   // this block of code will execute while updating the appointment 
            IEnumerable data = new DataClasses1DataContext().ScheduleDatas.Take(500); // nw.Appointment.Take(5); 
            return Json(data, JsonRequestBehavior.AllowGet); 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon