2
votes

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.

The new master page was created from the minimum.master generated from Sharepoint which comes already with a ScriptManager. I just added the needed AsyncPostBackTimeout="1000" EnableHistory="true", like so:

<asp:ScriptManager ID="ScriptManager" runat="server" AsyncPostBackTimeout="1000" EnableHistory="true" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />

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.

UpdatePanel -> MultiView -> View -> GridView -> Buttons

<asp:UpdatePanel runat="server" ID="updatepanel1" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:MultiView ID="MultiView" runat="server">
            <asp:View ID="ViewAll" runat="server">
                <div class="firstColumn">
                    <asp:Panel ID="pnlP" runat="server">
                        <asp:GridView ID="gvP" runat="server" AutoGenerateColumns="False"
                            PageSize="10" Width="100%" GridLines="None" CssClass="defaultTable" CellPadding="0"
                            CellSpacing="1" OnDataBound="gvP_OnDataBound">
                            <AlternatingRowStyle CssClass="odd" />
                            <RowStyle CssClass="even" />
                            <Columns>

                                <asp:BoundField DataField="PNumber" HeaderStyle-Width="10%" />
                                <asp:TemplateField>
                                    <HeaderStyle Width="20%"></HeaderStyle>
                                    <ItemTemplate>
                                        <%# Server.HtmlDecode(Eval("IObject").ToString())%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <HeaderStyle Width="10%"></HeaderStyle>
                                    <ItemTemplate>
                                        <asp:ImageButton ID="btnPDetails" runat="server" ImageUrl="/SiteCollectionImages/generic/generic.png"
                                            OnClick="btnDetails_Click" CommandName="PDetails" />
                                    </ItemTemplate>
                                </asp:TemplateField>
...

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.

It was working on Sharepoint 2007 with a ScriptManager created at runtime, but it has a safeguard using:

if (ScriptManager.GetCurrent(webpart.Page) == null)
            {
                ScriptManager scriptManager = new ScriptManager();
...

So the problem isn't there (I have checked it debuging).

It just seems that the update panel does not refresh now. I can't see any error server or client side...

I also tried to force the updatepanel to update on the end of the click event, to no avail, like so:

protected void btnDetails_Click(object sender, ImageClickEventArgs e)
{
                NavigateFromGridView(sender);
                updatepanel1.Update();
}

Any ideas?

2
possible duplicate of ASP.NET refresh Update PanelGreg
Yes, I saw that one, but like I said. I tried to force with Update(), but did not work. So there should be another way or there is something missing on my end.Pedro Costa
Any javascript errors ? when you try to make the update ?Aristos
None. Like I said, can't find any error client or server side...Pedro Costa

2 Answers

0
votes

can you use javascript to perform updatepanel full postback like as

_doPostBack('<%= UpdatePanel1.ClientID %>', '');

ie

_doPostBack('<%= upPortfolio.ClientID %>', '');