title: ASP.NET + ModalPopupExtender + Click Event
body: <p>I have an ASP.NET application that is using ASP.NET AJAX. I am using the ASP.NET AJAX Toolkit to present a dialog to a user. When the user clicks 'Yes' in the dialog, I want to handle that event in the code behind. However, I noticed that my click event is not being reached. Here is the main code:</p>
  
  <pre><code>&lt;asp:Panel ID="dialogContinuePanel" runat="server" style="display:none;" DefaultButton="yesButton"&gt;    
    &lt;div&gt;Are you sure you want to continue?&lt;/div&gt;
    &lt;div&gt;
      &lt;asp:ImageButton ID="yesButton" runat="server" AlternateText="Yes" ImageUrl="/resources/yes.png" OnClick="yesButton_Click" /&gt;
      &lt;asp:ImageButton ID="noButton" runat="server" AlternateText="No" ImageUrl="/resources/no.png" /&gt;
    &lt;/div&gt;
  &lt;/asp:Panel&gt;
  
  &lt;asp:LinkButton ID="hiddenLinkButton" runat="server" Text="" /&gt;
  &lt;cc1:ModalPopupExtender ID="dialogErrorExtender" runat="server" OkControlID="yesButton" 
    TargetControlID="hiddenLinkButton" PopupControlID="dialogContinuePanel"   
    CancelControlID="noButton" /&gt;                    
  </code></pre>
  
  <p>My Code Behind:</p>
  
  <pre><code>protected void yesButton_Click(object sender, EventArgs e)
  {
    string argument = yesButton.CommandArgument;
    // Do some processing and redirect the user
  }
  </code></pre>
  
  <p>How do I handle the click event of a Button that is used with a ModalPopupExtender? What am I doing wrong?</p>