Hi There
Please help, I’m desperate…
I’m trying to use the DHTMlX Scheduler.
So far, I’ve managed to display the calendar and I’m able to save events to the database.
The issue is that the events won’t load back from the DB to the scheduler.
I can see the events’ string
("“id”:1,“UserID”:null,“start_date”:“06/03/2013 0:00”,“end_date”:“06/03/2013 0:05”,“EventType”:null,“text”:“New event”,“NumOfAttachedFiles”:null,“FilesID”:null},{“id”:2,“UserID”:null,“start_date”:“06/03/2013 0:00”,“end_date”:“06/03/2013 0:05”,“EventType”:null,“text”:“New event”,"…"
In the ContentResult Data() method, but that data is never displayed.
I suspect it’s has something to do with my view: “Data.cshtml” (I’m using MVC), but I can’t seem to find the problem.
Any help will be highly appreciated!
Rotem
When I try to load the scheduler with Internet explorer I get a message-box with all the data from the database. I still can’t see the events themselves.
Can you provide the code of the Data action?
Make sure you’ve specified correct content type for data action response(text/json)
i get the exact problem, Please help
My Example Coding in controller,This is work fine.
public ContentResult Save(int? id, FormCollection actionValues)
{
var action = new DataAction(actionValues);
string tableupdated = "";
var data = new ContextTable();
try
{
var changedEvent = (CalendarEvent)DHXEventsHelper.Bind(typeof(CalendarEvent), actionValues);
var eventToUpdate = data.[someContextTable].SingleOrDefault(ev => ev.[myID] == action.SourceId);
DHXEventsHelper.Update(eventToUpdate, changedEvent, new List<string>() { "id" });
}
catch
{
action.Type = DataActionTypes.Error;
}
return (ContentResult)new AjaxSaveResponse(action);
}
.cshtml just coding
@Html.Raw(Model.Render())
Thanks snapper, But i have issues in showing datas from database in scheduler
check this forum post:
viewtopic.php?f=25&t=32775
Example is pushing data:
//IDScheduleParam : when use condition since first loading in index controller.
public static int IDScheduleParam
{
get
{
return _IDScheduleParam;
}
set
{
_IDScheduleParam = value;
}
}
[HttpGet] //First Load Page with Controller
public ActionResult Index(int ID)
{
var scheduler = new DHXScheduler(this);
try
{
IDScheduleParam = ID;
//SetUp Scheduler All Configuration
return View(scheduler);
}
catch (Exception ex)
{
TempData[“MsgLabel”] = ex.Message;
return View(scheduler);
}
} //close index
//In below method look like scheduler will reload data again.
public ContentResult Data()
{
var dc = new ContextView();
int ID;
dataset = [getdata from context] where id= IDScheduleParam
int i = 1;
var CalendarEventtmp = new List<CalendarEvent>();
foreach (var s_dataset in dataset)
{
var calendartmp = new CalendarEvent();
calendartmp.id = s_dataset.ID;
calendartmp.text = "xxx"
calendartmp.start_date = s_dataset.StartDate;
calendartmp.end_date = s_dataset.EndDate;
calendartmp.color = "orange";
CalendarEventtmp.Add(calendartmp);
i = i + 1;
}
var data = new SchedulerAjaxData(CalendarEventtmp);
return (ContentResult)data;
}