Hi,
I have used the below code to get the data.
public ActionResult GetData()
{
IEnumerable data = new ScheduleDataContext().DefaultSchedules.Take(2);
return Json(data, JsonRequestBehavior.AllowGet);
}
I have placed the GetData method in the controller named Schedule.
And the .cshtml code is as follows.
$(function () {
var localServ = "/Schedule/GetData";
var dManager = ej.DataManager({
url: localServ,
crudUrl: "/Schedule/CRUD" // Here you have to pass the post action name for the crud operation
});
dManager.adaptor = new ej.UrlAdaptor();
var query = ej.Query().from("DefaultSchedules");//.select("id,Subject,Location,StartTime,EndTime,Description,Categorize,AllDay");
$("#Schedule1").ejSchedule({
enableAppointmentNavigation: false,
currentDate: new Date(2015, 9, 22),
appointmentSettings: {
dataSource: dManager,
tableName: "DefaultSchedules",
query: query,
id: "Id",
subject: "Subject",
//location: "Location",
description: "Description",
startTime: "StartTime",
endTime: "EndTime",
allDay: "AllDay",
recurrence: "Recurrence",
recurrenceRule: "RecurrenceRule"
}
});
});
@(Html.EJ().Schedule("Schedule1")
.Width("100%")
.Height("525px")
.AppointmentSettings(fields => fields.Datasource(ds => ds.URL("Schedule/GetData").Adaptor("UrlAdaptor"))
.Id("Id")
.Subject("Subject")
.Description("Description")
.StartTime("StartTime")
.EndTime("EndTime")
.AllDay("AllDay")
.Recurrence("Recurrence")
.RecurrenceRule("RecurrenceRule"))
)
when i run the application, the browser shows the json data as below
[{"Id":1,"Subject":"Test Appointment","Description":"Test Appointment","StartTime":"\/Date(1442910600000)\/","EndTime":"\/Date(1442914200000)\/","AllDay":false,"Recurrence":false,"RecurrenceRule":"Test"}]
but the scheduler control is not visible. could you please tell me what changes needs to be done to get the appointment data bind to scheduler control ?