I'mworking on a project where I've to use ListView inside a nested repeater. I'm able to bind controls of listview and repeater at runtime but I'm unable to handle the ItemCommand event of ListView inside repeater.
My .aspx file looks like this
<On click of LinkButton1 and LinkButton2 I want to write some code, but I'm unable to handle the click event of LinkButton inside ListView which is inside two nested Repeater.
asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<table">
<tr>
<td> <asp:Label ID="Label1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Repeater ID="Repeater2" runat="server">
<ItemTemplate>
<table style="width: 100%;">
<tr style="width: 100%; background-color: Silver; color: Maroon;">
<td> <asp:Label ID="Label2" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<tr style="width: 100%;">
<td style="width: 70%;">
<asp:Label ID="Label3" runat="server"></asp:Label>
</td> <td style="width: 10%; text-align: center;">
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</td>
<td style="width: 10%; text-align: center;">
<asp:LinkButton ID="LinkButton2" runat="server">LinkButton2</asp:LinkButton>
</td>
</tr> </ItemTemplate>
<LayoutTemplate>
<table id="Table1" runat="server" style="width: 100%;">
<tr id="itemPlaceholder" runat="server" style="width: 100%;">
</tr>
</table>
</LayoutTemplate>
</asp:ListView> </td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater> </td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
Please help me solving the problem.
Thanks in advance.
Anonymous User
18-Oct-2010Hi Anoop,
You have to write Code in ItemCreated Event of Repeater.
This will solve your problem.