Skip to content

Implement the capability to drag and drop appointment info from ASPxScheduler to an outside area.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/asp-net-web-forms-scheduler-drop-appointment-to-external-control

Repository files navigation

Scheduler for ASP.NET Web Forms - How to drop an appointment from Scheduler to an external control

This example demonstrates how to drag and drop appointment info from ASPxScheduler to an outside area.

Implementation Details

The built-in drag-and-drop functionality in the ASPxScheduler can conflict with a custom implementation. To resolve the conflict, add a div element (drag panel) to an appointment template and disable the built-in drag-and-drop functionality in its onmousedown event handler.

<div class="draggable" style="background: blue;" onmousedown="DragPanelHold();">
function DragPanelHold() {
    // disable built-in dragging logic
    setTimeout('scheduler.mouseHandler.SwitchToDefaultState();', 0);
}

Attach the Draggable jQuery interaction to the drag panel so that it can be dragged. Attach the Droppable jQuery interaction to a drop target - adiv element with the ASPxListBox inside.

<div class="droppable">
	<dx:ASPxListBox ID="ASPxListBox1" runat="server"  ClientInstanceName="listBox">
	    <Items>
	        <dx:ListEditItem Text="Drop appointments here" Value="Drop appointments here" />
	    </Items>
	</dx:ASPxListBox>
</div>
function InitalizejQuery(s, e) {
    $('.draggable').draggable({ helper: 'clone', appendTo: 'body', zIndex: 100 });
    $('.droppable').droppable({
            activeClass: "dropTargetActive",
            hoverClass: "dropTargetHover",
            
            drop: function (ev, ui) {
                var appointmentId = $(ui.draggable).find("input[type='hidden']").val();
                listBox.AddItem(appointmentId);
                // Additional logic goes here...
            }
        }
    );
}

Call the InitalizejQuery method in the ASPxGlobalEvents.ControlsInitialized and ASPxGlobalEvents.EndCallback event handlers.

<dx:ASPxGlobalEvents ID="ASPxGlobalEvents1" runat="server">
    <ClientSideEvents ControlsInitialized="InitalizejQuery" EndCallback="InitalizejQuery" />
</dx:ASPxGlobalEvents>

Files to Review

Documentation

More Examples

About

Implement the capability to drag and drop appointment info from ASPxScheduler to an outside area.

Topics

Resources

License

Stars

Watchers

Forks