---
title: "ItemCommand Event in Nested Repeater and listview"  
description: "ItemCommand Event in Nested Repeater and listview"  
author: "Anoop Singh"  
published: 2010-10-16  
updated: 2010-10-18  
canonical: https://www.mindstick.com/forum/45/itemcommand-event-in-nested-repeater-and-listview  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# ItemCommand Event in Nested Repeater and listview

Hello,\
\
I'mworking on a [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects) where I've to use [ListView](https://www.mindstick.com/articles/12744/listview-in-android) inside a [nested](https://answers.mindstick.com/qa/30980/what-is-nested-trigger) [repeater](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control). I'm able to bind [controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net) of listview and repeater at [runtime](https://www.mindstick.com/articles/52/creating-timer-at-runtime-in-c-sharp-dot-net) but I'm unable to [handle](https://www.mindstick.com/articles/311004/suede-skillet-handle-cover) the ItemCommand event of ListView inside repeater.\
\
My .aspx file looks like this\
\

```
<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>
```

On click of LinkButton1 and LinkButton2 I want to write some code, but I'm unable to handle the [click event](https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event) of [LinkButton](https://www.mindstick.com/forum/2100/linkbutton-to-expand-gridview-causes-row-colors-from-function-to-be-lost) inside ListView which is inside two nested Repeater.\
\
Please help me solving the problem.\
\
Thanks in advance.![ItemCommand Event in Nested Repeater and listview](https://www.mindstick.com/app_images/htmleditor.icons/flower.gif)

## Replies

### Reply by Anonymous User

Hi Anoop,\
\
You have to write Code in ItemCreated [Event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) of Repeater.

```
    protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
    {
        Repeater Repeater2 = e.Item.FindControl("Repeater2") as Repeater;
        Repeater2.ItemCreated+=new RepeaterItemEventHandler(Repeater2_ItemCreated);
    }
     protected void Repeater2_ItemCreated(object sender, RepeaterItemEventArgs e)
    {
        ListView ListView1 = e.Item.FindControl("ListView1") as ListView;
        ListView1.ItemCommand+=new EventHandler<ListViewCommandEventArgs>(ListView1_ItemCommand);
    }
```

This will solve your problem.


---

Original Source: https://www.mindstick.com/forum/45/itemcommand-event-in-nested-repeater-and-listview

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
