AUTHOR: Marin Bratanov
DATE POSTED: July 07, 2014
HOW-TO: Allow certain tiles to navigate according to their NavigateUrl properties when the RadTileList's AutoPostBack property is set to true. PROBLEM: When RadTileList's AutoPostBack property is set to true, all tiles perform a postback regardless of their own AutoPostBack values and their NavigateUrl properties. This is noted in the Navigation help article. Also, RadTileList changes the AutoPostBack property of all its child tiles to true in order to capture their postbacks. Thus, they would not navigate even if the OnClientTileClicked event is cancelled. SOLUTION: Use the OnClientLoad event of the RadTileList to reset the AutoPostBack property of the tiles you wish to use for navigation only to false. You would need to define the condition for this change, and a good example is the presence of the NavigateUrl property. If it is set - the tile should always navigate, so its AutoPostBack property gets reset to false. Here is a small example:
<telerik:RadTileList runat=
"server"
ID=
"RadTileList1"
OnClientLoad=
"resetAutoPostBackTileProperties"
AutoPostBack=
"true"
OnTileClick=
"OnTileClick"
>
<Groups>
<telerik:TileGroup Name=
"Test"
<telerik:RadTextTile runat=
"TileAPBFalse"
"false"
NavigateUrl=
"the-desired-page.aspx"
Text=
"I will navigate only"
/>
"TileAPBTrue"
"I will POST this page"
</telerik:TileGroup>
</Groups>
</telerik:RadTileList>
<script type=
"text/javascript"
function
resetAutoPostBackTileProperties(sender, args) {
var
tiles = sender.get_allTiles();
for
(
i = 0; i < tiles.length; i++) {
//a default condition would be if the tile has NavigateUrl set
//you can use a custom one - e.g., the presence of a CSS class
if
(tiles[i].get_navigateUrl()) {
tiles[i].set_autoPostBack(
false
);
}
</script>
protected
void
OnTileClick(
object
sender, TileListEventArgs e)
{
Response.Write(
"Clicked Tile ID: "
+ e.Tile.ID);
Protected
Sub
RadTileList1_TileClick(sender
As
Object
, e
Telerik.Web.UI.TileListEventArgs)
Handles
RadTileList1.TileClick
+ e.Tile.ID)
End
Resources Buy Try