title: ASP.NET AJAX ModalPopupExtender - opening with wrong button
body: <p>I am having trouble with the AJAX ModalPopupExtender control. What I am trying to do is click a button, trigger a postcode lookup using Yahoo API with the button click event, display this in an asp panel in the ShowModalDialog box, and then close the dialog. I also need a separate button on the page to submit information using a form that is completely separate from this. </p>
  
  <p>I have set the target button up as follows:</p>
  
  <pre><code>&lt;asp:Button ID="btnStockist" runat="server" BackColor="#2C3473" OnClick="btnStockist_Click" /&gt;
  </code></pre>
  
  <p>The modalpopup is as follows:</p>
  
  <pre><code>&lt;ajax:ModalPopupExtender ID="mpeStockist" runat="server" okcontrolid="btnOkay" targetcontrolid="btnStockist" popupcontrolid="pnlDisplay" 
                              popupdraghandlecontrolid="PopupHeader" drag="true" backgroundcssclass="ModalPopupBG" &gt;&lt;/ajax:ModalPopupExtender&gt; 
  </code></pre>
  
  <p>What is actually happening is that when clicking the target button, the popup opens but the event does not trigger (no postcode lookup is done). However, clicking the separate, unrelated button on the same page DOES trigger the event, and the lookup works perfectly. I am able to close the dialog as normal. I have tried hiding the target button with CSS as a quick workaround, but the problem is that any other buttons on the page seem to trigger the lookup method and modalpopup no matter what their click event is programmed to do, and I need them to work separately.</p>
  
  <p>In case it's of any use, the panel code is here:</p>
  
  <pre><code>&lt;asp:Panel ID="pnlDisplay" style="display:none" runat="server"&gt;
                  &lt;div class="PopupContainer"&gt;
                      &lt;div class="PopupBody"&gt;                        
                          &lt;div align="center"&gt;Local Suppliers&lt;/div&gt;
                          &lt;br /&gt;&lt;br /&gt;
                          &lt;asp:label ID="lblError" runat="server"&gt;&lt;/asp:label&gt;
                          &lt;asp:UpdatePanel ID="upAlternatives" runat="server" UpdateMode="Conditional"&gt;
                              &lt;ContentTemplate&gt;
                              &lt;asp:DataList ID="dlStockist_Select" runat="server"&gt;
                                  &lt;HeaderTemplate&gt;
                                      &lt;table cellpadding="5" width="680"&gt;
                                          &lt;tr&gt;
                                              &lt;td&gt;Name&lt;/td&gt;
                                              &lt;td&gt;Address&lt;/td&gt;
                                              &lt;td&gt;Town/City&lt;/td&gt;
                                              &lt;td&gt;Miles (Approx)&lt;/td&gt;                                                                        
                                          &lt;/tr&gt;
                                  &lt;/HeaderTemplate&gt;
                                  &lt;ItemTemplate&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem, "CNAM") %&gt;&lt;/td&gt;
                                          &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem, "CADD1") %&gt;&lt;/td&gt;
                                          &lt;td&gt;&lt;%# DataBinder.Eval(Container.DataItem, "CADD3")%&gt;&lt;/td&gt;                                
                                          &lt;td align="center"&gt;&lt;%# DataBinder.Eval(Container.DataItem, "Distance")%&gt;&lt;/td&gt;                          
                                      &lt;/tr&gt;
                                  &lt;/ItemTemplate&gt;
                                  &lt;FooterTemplate&gt;
                                      &lt;/table&gt;            
                                  &lt;/FooterTemplate&gt;
                              &lt;/asp:DataList&gt;
                              &lt;/ContentTemplate&gt;
                          &lt;/asp:UpdatePanel&gt;
                          &lt;asp:LinkButton ID="btnOkay" runat="server" visible="true" Text="Close" CommandName="Update" BorderColor="#FFFFFF" BackColor="#000000" 
                              BorderWidth="3" BorderStyle="Double" ForeColor="White" Font-Size="13pt" style="cursor: pointer; padding: 1px 15px 1px 15px; 
                              margin-top: 10px;" Font-Underline="False"&gt;&lt;/asp:LinkButton&gt; 
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>Thanks in advance for the help</p>