Is it possible to add an EventHandler to a control added at runtime after Page_Load?
<p>based on the code below, it does not seem to be working. I can add a control dynamically to the page after Page_Load, but I cannot wire up an EventHandler to it.</p>

<p>Here is my code-behind:</p>

<pre><code>public partial class AddingControlsToPanelAtRuntime : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DrawPage();
    }

    private void DrawPage()
    {
        Label label;

        label = new Label();
        label.ID = "Label1";
        label.Text = "Label 1";
        Panel1.Controls.Add(label);
        Panel1.Controls.Add(new LiteralControl("&lt;br /&gt;"));

        label = new Label();
        label.ID = "Label2";
        label.Text = "Label 2";
        Panel1.Controls.Add(label);
        Panel1.Controls.Add(new LiteralControl("&lt;br /&gt;"));

        LinkButton linkButton1 = new LinkButton();
        linkButton1.ID = "linkButton1";
        linkButton1.Text = "linkButton 1";
        linkButton1.Click += new EventHandler(LinkButton_Click);
        Panel1.Controls.Add(linkButton1);
        Panel1.Controls.Add(new LiteralControl("&lt;br /&gt;"));

        LinkButton linkButton2 = new LinkButton();
        linkButton2.ID = "linkButton2";
        linkButton2.Text = "linkButton 2";
        linkButton2.Click += new EventHandler(LinkButton_Click);
        Panel1.Controls.Add(linkButton2);

    }

    protected void LinkButton_Click(object sender, EventArgs e)
    {
        Panel1.Controls.Add(new LiteralControl("&lt;p&gt;"));
        LinkButton linkButton4 = new LinkButton();
        linkButton4.ID = "linkButton4";
        linkButton4.Text = "linkButton 4";
        linkButton4.Click += new EventHandler(LinkButton_Click);
        Panel1.Controls.Add(linkButton4);
    }

}
</code></pre>

<p>So, in DrawPage(), which is called from Page_Load, all the controls are added to the Panel just fine, and the EventHandlers wire up perfectly.</p>

<p>When I click on the LinkButton1 or LinkButton2, they correctly call LinkButton_Click(). In LinkButton_Click() I add another control at runtime and wire up and EventHandler, but when I go to click on that link button, it only posts back to Page_Load and does NOT call LinkButton_Click().</p>

<p>So, is what I'm trying to do here just not possible based on the ASP.NET Pipeline?</p>
