Edit this page

OnClientTileDropping

The OnClientTileDropping event is raised when the user drops a tile after dragging it,but before the OnClientTileDropped event.This event can be cancelled. If it is cancelled the OnClientTileDropped will not fire.

This event can be used to check for a certain condition and prevent the drop of a tile.

The event handler receives two arguments:

  1. the RadTileList object that fired the event

  2. an event arguments object that exposes the following methods

OnClientTileDropping event arguments object

Name Return type Arguments Description
get_cancel() bool Gets a value that indicates whether the event is cancelled.
get_tile() RadBaseTile client-side object Gets a reference to the tile that is clicked.
set_cancel(value) bool Sets whether the event will be cancelled (if true is passed).

The following example shows how the drop operation can be prevented upon certain condition, e.g. that the user has been dragging the tile for too long which may indicate uncertainty on their part:

<telerik:RadTileList RenderMode="Lightweight" EnableDragAndDrop="true" ID="TileList2" runat="server" OnClientTileDropping="OnClientTileDroppingHandler"
    OnClientTileDragStart="OnClientTileDragStartHandler">
    <Groups>
        <telerik:TileGroup>
            <telerik:RadTextTile ID="RadTextTile1" Text="First tile" runat="server"></telerik:RadTextTile>
            <telerik:RadTextTile ID="RadTextTile2" Text="Second tile" runat="server"></telerik:RadTextTile>
            <telerik:RadTextTile ID="RadTextTile3" Text="Third tile" runat="server"></telerik:RadTextTile>
            <telerik:RadTextTile ID="RadTextTile4" Text="Fourth tile" runat="server"></telerik:RadTextTile>
            <telerik:RadTextTile ID="RadTextTile5" Text="Fifth tile" runat="server"></telerik:RadTextTile>
        </telerik:TileGroup>
    </Groups>
</telerik:RadTileList>
var dragStartTime = null;
function OnClientTileDroppingHandler(sender, args)
{
    var currTime = new Date();
    if (currTime.getSeconds() - dragStartTime.getSeconds() > 15 ||
    currTime.getMinutes() > dragStartTime.getMinutes())
    {
        //the user has been dragging the tile for too long
        args.set_cancel(true);
    }
}

function OnClientTileDragStartHandler(sender, args)
{
    dragStartTime = new Date();
}