title: ASP.NET - Add Event Handler to LinkButton inside of Repeater in a RenderContent call
body: <p>I've got a Sharepoint WebPart which loads a custom User Control. The user control contains a Repeater which in turn contains several LinkButtons. </p>
  
  <p>In the RenderContent call in the Webpart I've got some code to add event handlers:</p>
  
  <pre><code>        ArrayList nextPages = new ArrayList();
          //populate nextPages ....
          AfterPageRepeater.DataSource = nextPages;
          AfterPageRepeater.DataBind();
  
          foreach (Control oRepeaterControl in AfterPageRepeater.Controls)
          {
              if (oRepeaterControl is RepeaterItem)
              {
                  if (oRepeaterControl.HasControls())
                  {
                      foreach (Control oControl in oRepeaterControl.Controls)
                      {
                          if (oControl is LinkButton)
                          {
                              ((LinkButton)oControl).Click += new EventHandler(PageNavigateButton_Click);
                          }
                      }
                  }
              }
          }
  </code></pre>
  
  <p>The function PageNavigateButton_Click is never called however. I can see it being added as an event handler in the debugger however.</p>
  
  <p>Any ideas? I'm stumped how to do this. </p>