P
Peter Kirk
Hi
how do I create a "link" which calls a method in my code behind?
I have a repeater which shows a table of results, and some of the cells in
the table need to be clickable and cause things to happen.
Could be something like the following I want (doesn't work of course). Here
I try to create a cell with a clickable label which calls the method
MyMethod in my code behind, passing the id of the clicked row.
<asp:repeater id="ResultsRepeater" Runat="server">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="voyagelabel" Runat="server"
text="<%# ((DataRow)Container.DataItem).Name %>">
onclick="MyMethod(<%# ((DataRow)Container.DataItem).Id
%>)">
</asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:repeater>
Peter
how do I create a "link" which calls a method in my code behind?
I have a repeater which shows a table of results, and some of the cells in
the table need to be clickable and cause things to happen.
Could be something like the following I want (doesn't work of course). Here
I try to create a cell with a clickable label which calls the method
MyMethod in my code behind, passing the id of the clicked row.
<asp:repeater id="ResultsRepeater" Runat="server">
<ItemTemplate>
<tr>
<td>
<asp:Label ID="voyagelabel" Runat="server"
text="<%# ((DataRow)Container.DataItem).Name %>">
onclick="MyMethod(<%# ((DataRow)Container.DataItem).Id
%>)">
</asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:repeater>
Peter