title: Addhandler, button.click not firing using VB.NET
body: <p>I am experiencing a problem with buttons and AddHandler. It only works if I use AddHandler Button1.click, AddressOf... in Page_load, but if I create the button dynamically in one of the sub routines, the event doesn't fire.</p>
  
  <p>For example,</p>
  
  <pre><code>&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
  &lt;asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"&gt;
      &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt;
      &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt;
  &lt;/asp:DropDownList&gt;
  &lt;asp:ScriptManager id="ScriptManager1" runat="server"&gt;&lt;/asp:ScriptManager&gt;
  &lt;asp:UpdatePanel id="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False"&gt;
      &lt;contenttemplate&gt;
          &lt;asp:PlaceHolder id="PlaceHolder1" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
       &lt;/contenttemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  &lt;asp:UpdatePanel id="UpdatePanel2" runat="server" UpdateMode="Conditional"&gt;
      &lt;contenttemplate&gt;
          &lt;asp:Label id="Label2" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
      &lt;/contenttemplate&gt;
  &lt;/asp:UpdatePanel&gt;
  
  
  Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
      Label1.Text = Date.Now
      ScriptManager1.RegisterAsyncPostBackControl(DropDownList1)
  End Sub
  
  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
      Label2.Text = "Panel refreshed at " + Date.Now.ToString()
  End Sub
  
  Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
      Dim b As New Button
      b.Text = "Click"
      ScriptManager1.RegisterAsyncPostBackControl(b)
      AddHandler b.Click, AddressOf Button1_Click
      PlaceHolder1.Controls.Add(b)
      UpdatePanel1.Update()
  End Sub
  </code></pre>
  
  <p>The dropdownlist works, but the button doesn't. What am I doing wrong?</p>