search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

How to display a message after eventmove

Asked by Uli Held
15 years ago.

I handle the eventmove on the server side. But dependend on the selected event, the user is not allowed to move the event. Then I would like to display a message like "You are not allowed to move the event ..."

Detecting if a user is allowed to move a event is a time consuming operation, so it is not possible to check this in BeforeEventRender and set EventMoveEnabled to false for every event.

Comment posted by Dan Letecky
15 years ago.

There are two ways to do this:

  1. If it's possible to move the calculation to the client side: Switch to JavaScript handling, check if the move is allowed and call your action - either dpc1.eventMoveCallBack() or alert() with your message.
  2. If you want to keep in on the server side: Check if the action is allowed in the EventMove handler. If it's not, call DayPilotCalendar1.Update(message) without changing the database. "message" should be a Hashtable object with your own message details. Handle AfterRenderJavaScript and check the "data" variable and show the message accordingly.

Both these events are fired after the move is finished (the event is dropped at the target location).

Example of #2:


DayPilot tag:

... AfterRender="checkMessage(data)" ...


function checkMessage(data) {
 if (data) {
   if (data.type == "notallowed") {


protected void DayPilotCalendar1_EventMove(object sender, EventMoveEventArgs e)
  Hashtable msg = null;
  if (isAllowed(e)) {
    // update the db
    // ...
  else {
    msg = new Hashtable();
    msg["type"] = "notallowed";
    msg["message"] = "You are not allowed to move this event.";
  DayPilotCalendar1.DataSource = getYourData();

A working example of a similar AfterRender code can be found in the DayPilot Pro package, in Demo/Calendar/Default.aspx (.cs).

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.