Below is the update functionality at the server side using web forms (c#) Asp.Net.
Event creation is accomplished (the event appears on display and in database) but when deleting a red line marks event name on display and the event is not deleted from the database. Refresh will return the event to its original place. The same happens with update, refresh returns the previous page without changing the display or the database values.
======================================================================
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = “text/xml”;
var action = new DataAction(context.Request.Form);
var data = new SampleDataContext();
try
{
//create event object from request
var changedEvent = (T656Event)DHXEventsHelper.Bind(typeof(T656Event), context.Request.Form);
switch (action.Type)
{
case DataActionTypes.Insert: // define here your Insert logic
data.T656Events.InsertOnSubmit(changedEvent);
//action.TargetId = changedEvent.EventId;
break;
case DataActionTypes.Delete: // define here your Delete logic
changedEvent = data.T656Events.SingleOrDefault(ev => ev.EventId == action.SourceId);
data.T656Events.DeleteOnSubmit(changedEvent);
break;
default:// "update" // define here your Update logic
var updated = data.T656Events.SingleOrDefault(ev => ev.EventId == action.SourceId);
//update "updated" object by changedEvent's values, 'id' should remain unchanged
DHXEventsHelper.Update(updated, changedEvent, new List<string>() { "id" });
break;
}
data.SubmitChanges();
}
catch (Exception a)
{
action.Type = DataActionTypes.Error;
}
context.Response.Write(new AjaxSaveResponse(action).ToString());
//context.Response.Write(new AjaxSaveResponse(action).Render());
}