OnClientTileSelecting
The OnClientTileSelecting event is raised just before a tileis selected. It is cancellable and precedes the OnClientTileSelected event. If it is cancelled the OnClientTileSelected event is not raised.
This event can be used to prevent selection based on a certain criteria (e.g. information for the tile that is about to be selected). Cancelling this event will prevent the postback and the selection.
The event handler receives two arguments:
-
the RadTileList object that fired the event
-
an event arguments object that exposes the following methods
OnClientTileSelecting 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 about to be selected. | |
get_value() | bool | Returns true if the tile is selected. | |
set_cancel(value) | bool | Sets whether the event will be cancelled (if true is passed). |
The following example shows how to get information about a tile using the OnClientTileSelecting event of the RadTileList. Note that the event is cancellable and that selection is performed by right-clicking on a tile.
<telerik:RadTileList RenderMode="Lightweight" runat="server" ID="RadTileList1" AutoPostBack="false" SelectionMode="Single" OnClientTileSelecting="OnClientTileSelecting">
<Groups>
<telerik:TileGroup>
<telerik:RadTextTile Name="Sample Text Tile" Text="Lorem ipsum dolor sit amet" Title-Text="Sample"></telerik:RadTextTile>
</telerik:TileGroup>
</Groups>
</telerik:RadTileList>
<script type="text/javascript">
function OnClientTileSelecting(tileList, args) {
var tile = args.get_tile();
var response = confirm(String.format("Toggle the selection of {0}?", tile.get_name()));
if (!response) {
args.set_cancel(true);
}
}
</script>