title: .NET nested repeater - Button click calls OnItemCreated eventhandler, not OnItemCommand
body: <p>I have a project with a simple nested repeater. When i click the button, the OnItemCommand event is not called but the OnItemCreated is called (however, it does not call the Page_Load event handler). What am I misssing?</p>
  
  <p><strong>MARKUP</strong></p>
  
  <pre><code>  &lt;table width="100%"&gt;
      &lt;tr&gt;
          &lt;td&gt;my row&lt;/td&gt;
          &lt;td&gt;my description&lt;/td&gt;
      &lt;/tr&gt;
      &lt;asp:Repeater ID="rptMain" runat="server" OnItemCreated="rptMain_ItemCreated" OnItemCommand="rptMain_ItemCommand"&gt;
          &lt;ItemTemplate&gt;
          &lt;tr style="background-color:#45abdc;"&gt;
              &lt;td&gt;&lt;asp:LinkButton ID="ibtnDoSomething" runat="server" CommandArgument="SELECT" Text="Clicky" /&gt;&lt;/td&gt;
              &lt;td&gt;&lt;asp:Label ID="lblMainData" runat="server"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
  
          &lt;/tr&gt;
          &lt;asp:Repeater ID="rptChild" runat="server" OnItemCreated="rptChild_ItemCreated"&gt;
              &lt;ItemTemplate&gt;
                  &lt;tr style="background-color:#bcbbcb;"&gt;
                      &lt;td&gt;
  
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;asp:Label ID="lblChildData" runat="server"&gt;&lt;/asp:Label&gt;
                      &lt;/td&gt;
  
                  &lt;/tr&gt;
  
              &lt;/ItemTemplate&gt;
          &lt;/asp:Repeater&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:Repeater&gt;
  
     &lt;/table&gt;
  </code></pre>
  
  <p><strong>CODEBEHIND</strong>
      DataTable _childdata = new DataTable();
              DataTable _data = new DataTable();</p>
  
  <pre><code>        public void Page_Load()
          {
  
              _data.Columns.Add(new DataColumn("Text"));
              _data.Columns.Add(new DataColumn("CommandValue"));
  
              DataRow _row1 = _data.NewRow();
              _row1["Text"] = "Butch";
              _row1["CommandValue"] = "31";
              DataRow _row2 = _data.NewRow();
              _row2["Text"] = "Karl";
              _row2["CommandValue"] = "2";
              DataRow _row3 = _data.NewRow();
              _row3["Text"] = "Suzie";
              _row3["CommandValue"] = "8";
              DataRow _row4 = _data.NewRow();
              _row4["Text"] = "Kara";
              _row4["CommandValue"] = "31";
  
              _data.Rows.Add(_row1);
              _data.Rows.Add(_row2);
              _data.Rows.Add(_row3);
              _data.Rows.Add(_row4);
  
  
  
  
              _childdata.Columns.Add(new DataColumn("Text"));
              _childdata.Columns.Add(new DataColumn("CommandValue"));
  
              DataRow _crow1 = _childdata.NewRow();
              _crow1["Text"] = "Butch";
              _crow1["CommandValue"] = "Cupcakes";
              DataRow _crow2 = _childdata.NewRow();
              _crow2["Text"] = "Karl";
              _crow2["CommandValue"] = "Cheese";
              DataRow _crow3 = _childdata.NewRow();
              _crow3["Text"] = "Suzie";
              _crow3["CommandValue"] = "Pizaa";
              DataRow _crow4 = _childdata.NewRow();
              _crow4["Text"] = "Kara";
              _crow4["CommandValue"] = "Tofu";
              DataRow _crow5 = _childdata.NewRow();
              _crow5["Text"] = "Butch";
              _crow5["CommandValue"] = "Bacon";
              DataRow _crow6 = _childdata.NewRow();
              _crow6["Text"] = "Karl";
              _crow6["CommandValue"] = "Ham";
  
              _childdata.Rows.Add(_crow1);
              _childdata.Rows.Add(_crow2);
              _childdata.Rows.Add(_crow3);
              _childdata.Rows.Add(_crow4);
              _childdata.Rows.Add(_crow5);
              _childdata.Rows.Add(_crow6);
  
              rptMain.DataSource = _data;
              rptMain.DataBind();
  
          }
  
          public void rptMain_ItemCreated(object sender, RepeaterItemEventArgs e)
          {
  
              if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
              {
                  DataRowView drv = (DataRowView)e.Item.DataItem;
  
                  LinkButton ibtn = e.Item.FindControl("ibtnDoSomething") as LinkButton;
                  Label mainLabel = e.Item.FindControl("lblMainData") as Label;
                  ibtn.CommandArgument = drv["CommandValue"].ToString();
                  mainLabel.Text = drv["Text"].ToString();
                  DataView _dv = new DataView(_childdata, "Text = '" + drv["Text"].ToString() + "'", "Text", DataViewRowState.CurrentRows);
                  Repeater _rptChild = e.Item.FindControl("rptChild") as Repeater;
                  _rptChild.DataSource = _dv;
                  _rptChild.DataBind();
              }
  
          }
  
          public void rptChild_ItemCreated(object sender, RepeaterItemEventArgs e)
          {
              if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
              {
  
                  Label childLabel = e.Item.FindControl("lblChildData") as Label;
                  DataRowView drv = (DataRowView)e.Item.DataItem;
                  childLabel.Text = drv["Text"].ToString();
  
              }
          }
  
          public void rptMain_ItemCommand(object sender, RepeaterCommandEventArgs e)
          {
              Console.Write("fdasdfsa");
          }
  </code></pre>