May 11, 2012, 3:06 PM
[CLOSED] CalendarPanel Remote Data
Hi,
I have the following code to load the Events of the Calendar from the server side. For some reason, the events do not show on the calendar at all. Any help is appreciated.
View:
I have the following code to load the Events of the Calendar from the server side. For some reason, the events do not show on the calendar at all. Any help is appreciated.
View:
Html.X().CalendarPanel().Region(Region.Center).ActiveIndex(2).Border(false).CalendarStore(Html.X().CalendarStore().Calendars(calendars =>
{
calendars.Add(new CalendarModel() { CalendarId = 1, Title = "Home"});
calendars.Add(new CalendarModel() { CalendarId = 2, Title = "Work" });
calendars.Add(new CalendarModel() { CalendarId = 3, Title = "School" });
})).EventStore(Html.X().EventStore().Proxy(proxy => proxy.Add(Html.X().AjaxProxy().Url(Url.Action("GetEvents")).Json(true).Reader(reader => reader.Add(Html.X().JsonReader().Root("data"))))))
Action:public JsonResult GetEvents()
{
var data = new EventModelCollection();
data.Add(new EventModel()
{
EventId = 1001,
CalendarId = 1,
Title = "Vocation",
StartDate = DateTime.Now.AddDays(-20).AddHours(10),
EndDate = DateTime.Now.AddDays(-10).AddHours(15),
IsAllDay = false,
Notes = "Have Fun"
});
data.Add(new EventModel()
{
EventId = 1002,
CalendarId = 2,
Title = "Lunch with Matt",
StartDate = DateTime.Now.AddHours(11).AddMinutes(30),
EndDate = DateTime.Now.AddHours(13),
IsAllDay = false,
Location = "Chuy's!",
Url = "http://chuys.com",
Notes = "Order the queso",
Reminder = "15"
});
data.Add(new EventModel()
{
EventId = 1003,
CalendarId = 3,
Title = "Project Due",
StartDate = DateTime.Now.AddHours(15),
EndDate = DateTime.Now.AddHours(15),
IsAllDay = false
});
return Json(data);
}
Last edited by Daniil; May 18, 2012 at 5:01 PM.
Reason: [CLOSED]