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

Rad Tilelist Server-side click event Primary Key?

2 Answers 76 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Johann
Top achievements
Rank 1
Johann asked on 04 Nov 2014, 06:13 PM
Hi There

I'm using a RadTileList to display a range of items from a SQL DB.
I want each tile to link to a certain (the same) page and also provide the "ID" field of that item in a querystring. But I'm not sure how to accomplish this.

So I currently have this:
<telerik:RadTileList runat="server" ID="tileListSticky" AppendDataBoundItems="true" RenderMode="Classic"
                Width="100%" TileRows="4" OnTileDataBound="RadTileList1_OnTileDataBound" OnTileCreated="RadTileList1_OnTileCreated" Skin="Sunset" ScrollingMode="Auto" SelectionMode="Single" AutoPostBack="true" OnTileClick="tileListSticky_TileClick">

Importantly, the "OnTileClick" part fires an event, but I'm not sure how to go about getting the "ID" field of the item in the DB. It's not specifically bound to the tile either.

Regards
JohannS


2 Answers, 1 is accepted

Sort by
0
Johann
Top achievements
Rank 1
answered on 04 Nov 2014, 11:20 PM
Ok, looks like I succeeded finally.

By adding a button to the "Peek" template like this:

<div class="peekTemplateClass">
    <strong>Date Published:</strong>
    <asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "dateon")%>' runat="server" />
    <br />
    <strong>Number of Attachments:</strong>
    <asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "ATTCOUNT")%>' runat="server" />
    <br />
    <asp:Button Text="Read It!" CssClass="btn btn-primary btn-sm" ID="btnClickArt"
   CommandArgument='<%# DataBinder.Eval(Container.DataItem, "id")%>' OnClick="btnClickArt_Click" runat="server" />
</div>

I'm then able to easily get the "ID" field using the CommandArgument of the button (sender) and do whatever I like with it.
0
Otoniel
Top achievements
Rank 1
answered on 16 Dec 2019, 10:52 PM

Hi. Could you please share the server-side code to get the ID field value?

Thanks.

Tags
TileList
Asked by
Johann
Top achievements
Rank 1
Answers by
Johann
Top achievements
Rank 1
Otoniel
Top achievements
Rank 1
Share this question
or