This is a migrated thread and some comments may be shown as answers.

Server side click event not firing

1 Answer 104 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Hugo
Top achievements
Rank 1
Hugo asked on 11 Jul 2013, 06:10 PM
Hi,
First of all, I can get the event firing using the example provided here : http://www.telerik.com/help/aspnet-ajax/tilelist-server-side-events-ontileclick.html
But I'm unable to make it fire on my scenario, can you help?

The markup file:

<telerik:RadTileList runat="server" ID="RadTileList2" Width="1030px" TileRows="2"<br>SelectionMode="Single" EnableDragAndDrop="false" ScrollingMode="None" AutoPostBack="true" OnTileClick="OnTileClick"><br><groups><br><telerik:TileGroup><br><telerik:RadImageAndTextTile Name="First" NavigateUrl="http://www.telerik.com/" Title-Text="Telerik" Shape="Wide"><br><Title Text="Telerik"></Title><br></telerik:RadImageAndTextTile><br><telerik:RadImageAndTextTile Name="Second" NavigateUrl="http://www.google.com/" Title-Text="Google" Shape="Wide"><br><Title Text="Google"></Title><br></telerik:RadImageAndTextTile><br><telerik:RadImageAndTextTile Name="Third" NavigateUrl="http://www.bing.com" Text="Bing"><br></telerik:RadImageAndTextTile><br><telerik:RadImageAndTextTile Name="Fourth" NavigateUrl="http://www.wikipedia.org/" Text="Wikipedia"><br></telerik:RadImageAndTextTile><br></telerik:TileGroup><br></groups><br></telerik:RadTileList><br></div><br><div><br><telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" ImageUrl="~/Images/ProcessPhaseBar1.png"<br>ResizeMode="Fit" Width="100%" /><br></div><br></div>


The codebehind:

<font face="'Times New Roman', serif" style="font-size: 14px; line-height: 24px;">        private void BindTileList()</font><font face="'Times New Roman', serif" style="font-size: 14px; line-height: 24px;"><br>        {<br>            List<RadImageAndTextTile> listRadImageTiles = new List<RadImageAndTextTile>(Utils.Tiles.CreateSubjectRootTiles());<br>            foreach (RadImageAndTextTile radImageTile in listRadImageTiles)<br>                RadTileList2.Groups[0].Tiles.Add(radImageTile);<br><br>            RadTileList2.Groups.Add(tileGroup);<br></font><font face="'Times New Roman', serif" style="font-size: 14px; line-height: 24px;">        }</font><font face="'Times New Roman', serif" style="font-size: 14px; line-height: 24px;"><br><br></font><font face="'Times New Roman', serif" style="font-size: 14px; line-height: 24px;">        protected void OnTileClick(object sender, TileListEventArgs e)</font><font face="'Times New Roman', serif" style="font-size: 14px; line-height: 24px;"><br>        {<br>            clickResult.InnerHtml = "Clicked tile name and URL: " + e.Tile.Name + "<br />" + e.Tile.NavigateUrl;<br>            //note: e.Tile is of type RadBaseTile<br>        }</font>


We're able to get the event firing for the tiles created in the markup, but for the tiles created in the codebehind the event is not fired...

What could be wrong?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 16 Jul 2013, 12:13 PM
Hi Hugo,

This seems to work fine for me with the following code:
<telerik:RadTileList runat="server" ID="RadTileList2" Width="1030px" TileRows="2"
    SelectionMode="Single" EnableDragAndDrop="false" ScrollingMode="None" AutoPostBack="true"
    OnTileClick="OnTileClick">
    <Groups>
        <telerik:TileGroup>
            <telerik:RadImageAndTextTile Name="First" NavigateUrl="http://www.telerik.com/" Title-Text="Telerik"
                Shape="Wide">
                <Title Text="Telerik"></Title>
            </telerik:RadImageAndTextTile>
            <telerik:RadImageAndTextTile Name="Second" NavigateUrl="http://www.google.com/" Title-Text="Google"
                Shape="Wide">
                <Title Text="Google"></Title>
            </telerik:RadImageAndTextTile>
            <telerik:RadImageAndTextTile Name="Third" NavigateUrl="http://www.bing.com" Text="Bing">
            </telerik:RadImageAndTextTile>
            <telerik:RadImageAndTextTile Name="Fourth" NavigateUrl="http://www.wikipedia.org/"
                Text="Wikipedia">
            </telerik:RadImageAndTextTile>
        </telerik:TileGroup>
    </Groups>
</telerik:RadTileList>
<asp:Label ID="clickResult" Text="" runat="server" />
protected void Page_Init(object sender, EventArgs e)
{
    RadTextTile tile = new RadTextTile();
    tile.Text = "dynamically created tile 1";
    tile.NavigateUrl = "aaaaaaaaaaa";
    tile.Name = "dynamicTile1";
    RadTextTile tile2 = new RadTextTile();
    tile2.Text = "dynamically created tile 2";
    tile2.NavigateUrl = "bbbbbbbbb";
    tile2.Name = "dynamicTile2";
    RadTileList2.Groups[0].Tiles.Add(tile);
    RadTileList2.Groups[0].Tiles.Add(tile2);
}
 
protected void OnTileClick(object sender, TileListEventArgs e)
{
    clickResult.Text = "Clicked tile name and URL: " + e.Tile.Name + "<br />" + e.Tile.NavigateUrl;
}

You can also find a short video that demonstrates my test. Am I missing something? Does taking this approach work on your end?
I am afraid I cannot fully examine your snippets because they are quite malformed and the code-behind seems to have not made it in its full length.

Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
TileList
Asked by
Hugo
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or