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. Image for the cookie policy date
close icon

Can't show events with DataManager

Hello,
I created a sample with scheduler and I added dataManager and some schedule data with the help of asp.net core Data Binding tutorial. But my data doesn't show on the calendar. Can you help me figure this out?

the View:
@using Syncfusion.EJ2;
@using Syncfusion.EJ2.Schedule;

@{
    var dataManager = new DataManager()
    {
        
        Url = "GetData",
        Adaptor = "UrlAdaptor",
        CrossDomain = true
    };
}
@{
    ViewBag.Title = "Schedule";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Schedule Features:</h2>
<br />
<li> Schedule Samples - Default</li>
<li> Theme - Bootstrap-Theme</li>
<br />
<div id="ControlRegion">
    <ejs-schedule id="schedule" height="550px" selectedDate="new DateTime(2018, 2, 15)">
        <e-schedule-eventsettings dataSource="dataManager"></e-schedule-eventsettings>
    </ejs-schedule>
</div>

controller:
     [HttpPost]
        public JsonResult GetData()
        {
    var data = new ScheduleData().GetScheduleData();
            return Json(data);
        }

        public ActionResult ScheduleFeatures()
        {
            return View();
        }


public class ScheduleData
    {
        public List<AppointmentData> GetScheduleData()
        {
            List<AppointmentData> appData = new List<AppointmentData>();
            appData.Add(new AppointmentData
            {
                Id = 1,
                Subject = "Explosion of Betelgeuse Star",
                StartTime = new DateTime(2018, 2, 11, 9, 30, 0),
                EndTime = new DateTime(2018, 2, 11, 11, 0, 0),
                CategoryColor = "#1aaa55"
            });
            appData.Add(new AppointmentData
            {
                Id = 2,
                Subject = "Thule Air Crash Report",
                StartTime = new DateTime(2018, 2, 12, 12, 0, 0),
                EndTime = new DateTime(2018, 2, 12, 14, 0, 0),
                CategoryColor = "#357cd2"
            });
            return appData;
        }       
        public class AppointmentData
        {
            public int Id { get; set; }
            public string Subject { get; set; }
            public DateTime StartTime { get; set; }
            public DateTime EndTime { get; set; }
            public string CategoryColor { get; set; }
        }        
    }
}




Attachment: EssentialJS2WebApplication4_b0969dba.rar

1 Reply

VD Vinitha Devi Murugan Syncfusion Team November 4, 2019 10:28 AM UTC

Hi theofilos, 
 
Syncfusion Greetings. 
 
We have checked the reported problem with your shared sample which was due to casing issue in the Json datasource. The issue can be overridden by using the following line in Startup.cs file and same can be available in below link. 
 
 
services.AddMvc() 
        .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver()); 
 
 
Regards, 
M.Vinitha devi 
 


Loader.
Live Chat Icon For mobile
Up arrow icon