title: ASP.NET ImageButton Onclick Event not handled
body: <p>I have an ImageButton in a GridView.</p>
  
  <pre><code>&lt;asp:GridView ID="ItemGridView" runat="server" DataKeyNames="Id" 
       OnRowDataBound="ItemGridView_RowDataBound" AllowPaging="True" 
       AllowSorting="True" EnableSortingAndPagingCallbacks="True" 
       AutoGenerateEditButton="False" AutoGenerateDeleteButton="false"
       DataSourceID="ItemDataSource" EnableViewState="true" &gt;
      ....
      &lt;asp:TemplateField ShowHeader="False" ItemStyle-Width="40px"&gt;
        &lt;ItemTemplate&gt;
           &lt;asp:ImageButton ID="btnDelete" SkinID="btnDelete"
              runat="server" CausesValidation="false"
              OnClick="btnDeleteAccountItem_Click" 
              OnClientClick="javascript:return confirm('Are you sure?');" /&gt;
         &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>and a corresponding handler for the delete button event</p>
  
  <pre><code>protected void btnDeleteAccountItem_Click(object sender, EventArgs e) {
      ImageButton btnDel = sender as ImageButton;
      GridViewRow row = (GridViewRow)btnDel.NamingContainer;
      ....
  }
  </code></pre>
  
  <p>I am using this very same construct in many places and it works fine. I have one gridview now, though, where it does not, and I am hoping to get some ideas for how to track down the problem.
  When I click the button, the client-side event fires and the alert box is displayed, then the post-back fires and I can hit a break point in the <code>Page_Load</code> method. So the client-side wiring of the button events seems to work. However, the event is not handled and the method btnDeleteAccountItem_Click does not get called.</p>
  
  <p>This is a complex page and I cannot post all the code. What can I do to narrow down potential causes?   </p>