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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can't show events with DataManager

Thread ID:

Created:

Updated:

Platform:

Replies:

148739 Nov 1,2019 10:21 AM UTC Nov 4,2019 10:28 AM UTC ASP.NET Core - EJ 2 1
loading
Tags: Scheduler
theofilos
Asked On November 1, 2019 10:21 AM UTC

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

Vinitha Devi Murugan [Syncfusion]
Replied On 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 
 


CONFIRMATION

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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon