My scheduler contains 3 dropdowns(select) in the lightbox. If anyone is not selected save action catches exception and set action.Type to DataActionTypes.Error .
[code] public ActionResult Save(string mode, int? ObjectId, FormCollection actionValues)
{
var action = new DataAction(actionValues);
var changedEvent = (Event)DHXEventsHelper.Bind(typeof(Event), actionValues);
int check_exist = _iManageVacancy.CheckExistingProperty(Convert.ToInt32(ObjectId), Convert.ToInt32(changedEvent.property_id));
action.Type = check_exist == 0 ? DataActionTypes.Insert : DataActionTypes.Update;
try
{
if (mode == "lead")
{
switch (action.Type)
{
case DataActionTypes.Insert:
changedEvent.id = _iManageVacancy.AddNewEvent(changedEvent, Convert.ToInt32(ObjectId), Convert.ToInt32(changedEvent.property_id));
break;
default:// "update"
if (check_exist != 0)
changedEvent.id = check_exist;
changedEvent.id = _iManageVacancy.UpdateEvent(changedEvent, Convert.ToInt32(ObjectId), Convert.ToInt32(changedEvent.property_id));
break;
}
action.TargetId = changedEvent.id;
}
else if (mode == "workorder")
{
switch (action.Type)
{
default: // "updated"
changedEvent.id = _iManageMaintanence.UpdateEvent(changedEvent);
break;
}
}
}
catch (Exception a)
{
action.Type = DataActionTypes.Error;
}
return new AjaxSaveResponse(action);
}[/code]
But how to show that error to users as an alert?