title: Asp.Net Button click Event inside Repeater inside UpdatePanel
body: <p>I am trying to use a Repeater inside a Updatepanel and have Buttons that delete one entery in the Database and get the new Data for the Repeater and Update the Panel. I have tried a LinkButton, but it does always postback and the page relodes. Then i tried a regular Button and create a Event for that Button on DataBound Event. But it doesnt work. Here is the code:</p>
  
  <p>aspx file:</p>
  
  <pre><code> &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt;
      &lt;asp:UpdatePanel runat="server" id="Panel"&gt;
          &lt;ContentTemplate&gt; 
              &lt;table cellpadding="0" cellspacing="0" id="saveTable"&gt;
                  &lt;tr style="font-weight: bold;"&gt;
                      &lt;td&gt;Erstellt am&lt;/td&gt;
                      &lt;td&gt;Anforderer&lt;/td&gt;
                      &lt;td&gt;Werk&lt;/td&gt;
                      &lt;td&gt;Gebäude&lt;/td&gt;
                      &lt;td&gt;Start Datum&lt;/td&gt;
  
                      &lt;td&gt;Löschen&lt;/td&gt;
                      &lt;td&gt;Benutzen&lt;/td&gt;
                  &lt;/tr&gt; 
  
  
              &lt;asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound"&gt;
                  &lt;ItemTemplate&gt;
  
                  &lt;tr id="Meldung&lt;%# DataBinder.Eval(Container.DataItem,"meldungId")%&gt;"&gt;
                      &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem, "timestamp").ToString().Substring(0, 10)%&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem,"nameAnforderer") %&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem,"Werk") %&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem,"Building") %&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem,"startDatum").ToString().Substring(0, 10) %&gt;&lt;/td&gt;
                      &lt;td&gt;
                          &lt;asp:Button runat="server" ID="test"/&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  
                 &lt;/ItemTemplate&gt;
              &lt;/asp:Repeater&gt;
              &lt;/table&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>and in the code behind i give the Button with id = test a event</p>
  
  <pre><code>    protected void deleteMeldung(object sender, EventArgs e) {
          System.Threading.Thread.Sleep(5000);
      }
  
      protected void Repeater1_ItemDataBound(object source, RepeaterItemEventArgs e) {
          RepeaterItem repeaterSource = e.Item;
          Button btn1 = repeaterSource.FindControl("test") as Button;
          DataRowView drv = e.Item.DataItem as DataRowView;
          string meldungId = drv.Row["meldungId"].ToString();
  
          btn1.ID = "myNewButton"+meldungId;
          btn1.Click += new EventHandler(deleteMeldung);
          btn1.Text = "delete";
  
      }
  </code></pre>
  
  <p>so whats working is passing the Text and the ID to each button like that. But the Buttons do not have the Click Event to call deleteMeldung()</p>