You can control the drag and drop event moving using a real-time onEventMoving event handler. This event is fired whenever the target position changes.

JavaScript

Prevent Moving from Resource "A" to Resource "B"

dp.onEventMoving = function(args) {
    // don't allow moving from A to B
    if (args.e.resource() === "A" && args.resource === "B") {
        args.left.enabled = false;
        args.right.html = "You can't move an event from resource A to B";

        args.allowed = false;
    }
};

Prevent Dragging Events Out of the Visible Range

dp.onEventMoving = function(args) {

  if (args.end > dp.visibleEnd()) {
      args.left.enabled = true;
      args.left.html = "You can't drag the event out of the visible range";
      args.right.enabled = true;
      args.allowed = false;
  }

  if (args.start < dp.visibleStart()) {
      args.right.enabled = true;
      args.right.html = "You can't drag the event out of the visible range";
      args.left.enabled = true;
      args.allowed = false;
  }
};

Adjusting the Target Position

This example places the event in the first available slot if there already are any events in the target position.

if (args.resource === "C") {
  var except = args.e.data;
  var events = dp.rows.find(args.resource).events.all();

  var start = args.start;
  var end = args.end;
  var overlaps = events.some(function(item) {
      return item.data !== except && DayPilot.Util.overlaps(item.start(), item.end(), start, end);
  });

  while (overlaps) {
      start = start.addDays(1);
      end = end.addDays(1);

      overlaps = events.some(function(item) {
          return item.data !== except && DayPilot.Util.overlaps(item.start(), item.end(), start, end);
      });
  }

  args.start = start;
  args.end = end;

  args.left.enabled = false;
  args.right.html = "Start automatically moved to " + args.start.toString("d MMMM, yyyy");
}

Events Must Start on Workdays

dp.onEventMoving = function(args) {
  // must start on a working day
  while (args.start.getDayOfWeek() == 0 || args.start.getDayOfWeek() == 6) {
      args.start = args.start.addDays(1);
  }
  args.left.enabled = false;
  args.right.html = "Events must start on a workday.";
};

Customized Snap-To-Grid

The cell size is set to one hour (scale property) but the event snaps to 5-minute segments during moving.

dp.scale = "Hour";

dp.snapToGrid = false;
dp.onEventMoving = function(args) {
  var offset = args.start.getMinutes() % 5;
  if (offset) {
      args.start = args.start.addMinutes(-offset);
      args.end = args.end.addMinutes(-offset);
  }

  args.left.enabled = true;
  args.left.html = args.start.toString("h:mm tt");
};

Demo:

ASP.NET WebForms

You can set the event handler using EventMovingJavaScript property.

<DayPilot:DayPilotScheduler
  ...
  EventMovingJavaScript="eventMoving(args);"
/>

<script>
function eventMoving(args) { // don't allow moving from A to B if (args.e.resource() === "A" && args.resource === "B") { args.left.enabled = false; args.right.html = "You can't move an event from resource A to B"; args.allowed = false; } };
</script>

ASP.NET MVC

@Html.DayPilotScheduler("dps", new DayPilotSchedulerConfig {
    BackendUrl = Url.Action("Backend", "Scheduler"),
    // ...
    EventMovingJavaScript = "onEventMoving(args)"
})


<script>
function eventMoving(args) { if (args.e.resource() === "A" && args.resource === "B") { args.left.enabled = false; args.right.html = "You can't move an event from resource A to B"; args.allowed = false; } };
</script>