I am creating the equivalent of the custom lightbox control in MVC3.
I have followed the code at scheduler-net.com/docs/lightbox. … definition , but when i select an empty sliot on the scheduler(where no id is defined) the code falls over (as there is no id to assign to the hidden buttons in the view).
public ActionResult PartView(int id)
{
ScheduledActivityViewModel vm = new ScheduledActivityViewModel();
var context = new ScheduledActivitiesDataContext();
vm.scheduledEvent = context.Events.SingleOrDefault(e => e.id == id);
return View(vm);
}
Note that other than the view model the code is the same as that used in the example.
public ActionResult LightboxControl(Event ev)
{
var context = new DHXSchedulerDataContext();
var current = context.Events.SingleOrDefault(e => e.id == ev.id);
if (current == null)
current = ev;
return View(current);
}
you should handle case when new entry is added( which means data context doesn’t contains it). you may use mvc model binder(as in sample) or create Event manually, Request.Form contains all needed values - start_date, end_date, temporary id, etc
When i save or cancel i get an action error after DataAction(actionValues) is called (an error is returned). Is there something specific that i need to do?
I can’t see what the error is, as it appears within the dhtmlx DataAction method.
public ActionResult Save(Event changedEvent, FormCollection actionValues)
{
ScheduledActivitiesDataContext data = new ScheduledActivitiesDataContext();
var action = new DataAction(actionValues);
The error occurs when it gets passed to the dhtmlx.DataAction() method.
The controller for the view is
public ActionResult LB(Event ev)
{
ScheduledActivityViewModel vm = new ScheduledActivityViewModel();
vm.scheduledEvent = context.Events.SingleOrDefault(e => e.id == ev.id);
if (vm.scheduledEvent == null)
vm.scheduledEvent = ev;
return View(vm);
}
Hi,
looks like i don’t quite understand what exactly goes wrong
do you get a runtime error? if so what exception message is?
or DataAction’s type is ‘Error’ ?
var action = new DataAction(actionValues);
if yes, it is supposed to be so. This is needed to define if action is called by native scheduler’s controls(such as default lightbox, or drag’n’drop) or by custom lightbox.
If action type is recognized(it’s insert, update or delete) we can process it common way scheduler-net.com/docs/managing_ … ode_sample
Otherwise you may need process form data in some other way, like it shown in this sample scheduler-net.com/docs/lightbox.html#crud_logic
to use the same logic for both types of operations(custom lighbox’s and native scheduler’s) your form must send one extra field “!nativeeditor_status” with operation type - “inserted”, “updated” “deleted”, “error”
What i am noticing when implementing the code from the secnd page that you have linked to is that the AjaxSaveResponse does not have two overloads? Am i therefore using an out of daye version of the dhtmlx code?
Also, when i select the buttons the partial view submits and then becomes a blank form.
Hello,
I also have the same problem, when i select the buttons the partial view submits and then becomes a blank form and i use return (new SchedulerFormResponseScript(action, changedEvent));
I also have the same problem, when i select the buttons the partial view submits and then becomes a blank form and I use: return (new SchedulerFormResponseScript(action, changedEvent));