title: Refreshing an UpdatePanel inside of a modal popup
body: <p>Obviously I am doing something wrong, just not sure what...
  I have a modal popup and inside of that is an Update Panel which in turn contains a gridview. When the modal popup is first called I would like to refresh the UpdatePanel (and grid data).</p>
  
  <p>I have the code working so that the panel is updated when a button is pressed btnHiddenJSRefresh (currently not hidden). But I can not get this to work without having to press the button!</p>
  
  <p>I've tried 'clicking' the button via Jquery $("&lt;%= btnHiddenJSRefresh.ClientID %>").click();
  And I can see it gets called, but there is no reaction on the page. 
  Same with __doPostBack("&lt;%= btnHiddenJSRefresh.ClientID %>", "");</p>
  
  <p>Also (and this may be unrelated) the delete option in the gridview does not work here. Outside of the UpdatePanel it works fine... </p>
  
  <p>Here's the code, I've tried to reduce it down to the main area of issue</p>
  
  <pre><code>&lt;ajaxact:modalpopupextender id="ModalPopupExtender1" runat="server"
  cancelcontrolid="ClosePopup" okcontrolid="ClosePopup"
  targetcontrolid="hidenSelectedDoc" popupcontrolid="THolder"
  popupdraghandlecontrolid="PopupHeader" drag="true" BehaviorID="MPE" Y="0" backgroundcssclass="ModalPopupBG"&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;div classs="ModalPopup" id="THolder" &gt;
      &lt;a id="ClosePopup" href="#"&gt;Close&lt;/a&gt;
      &lt;asp:Button ID="btnHiddenJSRefresh" runat="server" Text="Button" UseSubmitBehavior="false" OnClick="btnAddTag_Click" /&gt;
  
      &lt;asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional" OnLoad="UpdatePanel2_Load" &gt;
  
          &lt;ContentTemplate&gt;            
      &lt;asp:GridView ID="gvPageTags" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourcePageTags"  CssClass="TableDataHolder" DataKeyNames="CarID" &gt;
                          &lt;Columns&gt;
                              &lt;asp:BoundField DataField="FullName" HeaderText="Full Name" SortExpression="FullName" /&gt;                               
                              &lt;asp:TemplateField HeaderText="Delete"&gt;
                                  &lt;ItemTemplate&gt;                                           
                                          &lt;asp:ImageButton ID="deleteButtonImg" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this car?');" ImageUrl="~/images/icons/DeleteIconS.png" AlternateText="Delete" /&gt;
                                  &lt;/ItemTemplate&gt;
                              &lt;/asp:TemplateField&gt;
                          &lt;/Columns&gt;                             
                      &lt;/asp:GridView&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
  
      &lt;asp:SqlDataSource ID="SqlDataSourcePageTags" runat="server"
                      ConnectionString="&lt;%$ ConnectionStrings:bobConnectionString %&gt;"
                      SelectCommand="SELECT * FROM Cars WHERE (cMake = @cMake)"
                      DeleteCommand="DELETE * FROM Cars WHERE CarID = @CarID"&gt;                       
                      &lt;SelectParameters&gt;
                          &lt;asp:Parameter Name="cMake" DefaultValue="0" Type="int32" /&gt;
                      &lt;/SelectParameters&gt;
                  &lt;/asp:SqlDataSource&gt;
  
      &lt;/div&gt;           
  </code></pre>
  
  <p>Code behind</p>
  
  <pre><code>protected void btnAddCar_Click(object sender, EventArgs e)
      {
          SqlDataSourcePageTags.SelectParameters["cMake"].DefaultValue = hidenSelectedcMake.Value;
          SqlDataSourcePageTags.DataBind();
          gvPageTags.DataBind();
          UpdatePanel2.Update();
      }
  </code></pre>
  
  <p>Any ideas would be great.</p>
  
  <p>Thanks</p>