title: Force update panel to refresh
body: <p>I'm migrating a sharepoint 2007 website to 2013, we have done all the steps and are finalizing it with building 2013 master pages to substitute the old ones, but we are having a problem with an updatepanel used in one of the webparts.</p>
  
  <p>The new master page was created from the minimum.master generated from Sharepoint which comes already with a ScriptManager. I just added the needed <code>AsyncPostBackTimeout="1000" EnableHistory="true"</code>, like so:</p>
  
  <pre><code>&lt;asp:ScriptManager ID="ScriptManager" runat="server" AsyncPostBackTimeout="1000" EnableHistory="true" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" /&gt;
  </code></pre>
  
  <p>Then in the user control that the webpart uses there is an update panel which has a a MultiView control which has some other controls also inside. The buttons that make the postback are inside of a gridview which in turn is inside of MultiView. </p>
  
  <p>UpdatePanel -> MultiView -> View -> GridView -> Buttons</p>
  
  <pre><code>&lt;asp:UpdatePanel runat="server" ID="updatepanel1" UpdateMode="Conditional"&gt;
      &lt;ContentTemplate&gt;
          &lt;asp:MultiView ID="MultiView" runat="server"&gt;
              &lt;asp:View ID="ViewAll" runat="server"&gt;
                  &lt;div class="firstColumn"&gt;
                      &lt;asp:Panel ID="pnlP" runat="server"&gt;
                          &lt;asp:GridView ID="gvP" runat="server" AutoGenerateColumns="False"
                              PageSize="10" Width="100%" GridLines="None" CssClass="defaultTable" CellPadding="0"
                              CellSpacing="1" OnDataBound="gvP_OnDataBound"&gt;
                              &lt;AlternatingRowStyle CssClass="odd" /&gt;
                              &lt;RowStyle CssClass="even" /&gt;
                              &lt;Columns&gt;
  
                                  &lt;asp:BoundField DataField="PNumber" HeaderStyle-Width="10%" /&gt;
                                  &lt;asp:TemplateField&gt;
                                      &lt;HeaderStyle Width="20%"&gt;&lt;/HeaderStyle&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;%# Server.HtmlDecode(Eval("IObject").ToString())%&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
                                  &lt;asp:TemplateField&gt;
                                      &lt;HeaderStyle Width="10%"&gt;&lt;/HeaderStyle&gt;
                                      &lt;ItemTemplate&gt;
                                          &lt;asp:ImageButton ID="btnPDetails" runat="server" ImageUrl="/SiteCollectionImages/generic/generic.png"
                                              OnClick="btnDetails_Click" CommandName="PDetails" /&gt;
                                      &lt;/ItemTemplate&gt;
                                  &lt;/asp:TemplateField&gt;
  ...
  </code></pre>
  
  <p>It should switch view when I press the details. It does everything right on the server side and if I remove the update panel it works.</p>
  
  <p>It was working on Sharepoint 2007 with a ScriptManager created at runtime, but it has a safeguard using:</p>
  
  <pre><code>if (ScriptManager.GetCurrent(webpart.Page) == null)
              {
                  ScriptManager scriptManager = new ScriptManager();
  ...
  </code></pre>
  
  <p>So the problem isn't there (I have checked it debuging).</p>
  
  <p>It just seems that the update panel does not refresh now. I can't see any error server or client side...</p>
  
  <p>I also tried to force the updatepanel to update on the end of the click event, to no avail, like so:</p>
  
  <pre><code>protected void btnDetails_Click(object sender, ImageClickEventArgs e)
  {
                  NavigateFromGridView(sender);
                  updatepanel1.Update();
  }
  </code></pre>
  
  <p>Any ideas?</p>