Server side validation messages return to scheduler

Hi,
In my MVC3 application, I am using the scheduler with lightbox and with the “Save” button click, it goes to the “Save” action. What I need is, In the server side Save method, I have to do few business logic validations and base on that I have to send back a proper messages to client side.
e.g: I enter values in the lightbox and hit Save method, which calls the controller save method.
Inside this method I do validations and base on that result I decide whether save the data or not. And then I have to return a error message list back to client.
Is there any possibility of doing this?

Hi,
you can return error message from the server, c#:[code]public ContentResult Save(int? id, FormCollection actionValues)
{
var action = new DataAction(actionValues);

   //validate it somehow
   if(isInvalid){
        //set error status
        action.Type = DataActionTypes.Error;
        //assign error message
        action.Message = "Invalid event";
   }else{
        //do action
   }
   ...
   
   return (new AjaxSaveResponse(action));

}[/code]
and display it on the client, js:scheduler.dataProcessor.attachEvent("onAfterUpdate", function (sid, action, tid, tag) { if (action == "error") { dhtmlx.message(tag.text || tag.textContent);//display action.Message } })

How can we return error message when using a custom light box and returning SchedulerFormResponseScript instead of AjaxSaveResponse?


return (new SchedulerFormResponseScript(action, updateEvent));