Using Updatepanel in sharepoint 2013 web part RRS feed

  • Question

  • Hi Experts,

    We are facing problem related to updatepanel in sharepoint 2013. we have a sample webpart that includs a label and a button, we want to write somthing to label in click event of button without refreshing the whole page. Our sample code is as followed :

     <asp:UpdatePanel runat="server" ID="UpdatePanel1">
                <asp:Label ID="lbl" runat="server" Text="Loaded" Visible="true"></asp:Label>
                <asp:Button ID="btn" runat="server" OnClick="btn_Click"/>
                <asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />

            protected void btn_Click(object sender, EventArgs e)
                lbl.Text = "BUTTON CLICKED !";
                lbl.Visible = true;

    We have tried the solution mentioned on this link but could not achieve our goal.

    Any solution for this problem along with sample code will be highly appreciated.


    A Learner

    Wednesday, April 3, 2013 3:47 PM

All replies

  • Hi

    You don't need this:

         <asp:AsyncPostBackTrigger ControlID="btn" EventName="Click" />

    all child controls in UpdatePanel by default act as triggers so you don't need this part and it will automatically do the job.

    Saturday, April 27, 2013 11:04 AM
  • Hi,

    I also have this problem... How can I use a updatePanel inside a Visual WebPart...

    Any new findings?



    Sunday, July 14, 2013 11:45 AM
  • Hi Hunain,

    You don't need the block for "Triggers". Please find below a sample code which works perfectly.   

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
               <asp:Label ID="lblTest" runat="server" Text="Label"></asp:Label>
                <asp:LinkButton ID="AddLink" runat="server" OnClick="AddLink_Click">Click Me</asp:LinkButton>
    protected void AddLink_Click(Object sender, EventArgs e)
         lblTest.Text = "I am Invoked";

    Sunday, July 14, 2013 4:08 PM
  • Hi Narahari,

    thanks für your reply... Unfortenatly it deoesn't work for me in a Webpart...

    I always have a full page request in SharePoint 2013...

    Any further hints?


    Sunday, July 14, 2013 4:20 PM
  • Have you added to add script manager in your page? You can try to enable script debugging in IE and try to find out what exception you are getting on client side.

    Sohel Rana

    Monday, July 15, 2013 6:02 AM
  • Hi Bernhard,

    I feel there's a bad javascript error on the page which is breaking the Microsoft's javascript for UpdatePanel. Please turn on your IE developer console and debug. Check whether you have any Page load JS errors or button click JS errors? Mostly Javascript errors break the AJAX logic and make the postback behave like a regular postback. 

                Also, try removing the update panel and make sure the page works perfectly without any Javascript errors. Then, simply add the update panel. Please note that normally the script manager or trigger blocks are not required in SP2013. Only UpdatePanel should do the trick.


    Monday, July 15, 2013 7:23 AM
  • Hi Sohel,

    thanks for your reply. Yes I added a scriptmanager... Just beside without Scriptmanager a error is raised. For me no error is thrown but instead of an ajax request an full page reload is done.

    I followed this "tutorial" 
    http://weblogs.mysharepoint.de/blogs/fabianm/archive/2008/06/28/ajax-funktionen-in-sharepoint-webparts-integrieren.aspx  (in German)

    But in short words:

    1) Register ScriptManager

    2) Enable UpdatePanelFix

    But may be the reason is that SP 2013 doesn't use 

    return _spFormOnSubmitWrapper();

    anymore. For me the I have a form tag for the complete page with the following action


    Any hints for this?

    Thanks Bernhard

    Monday, July 15, 2013 7:29 AM
  • Hi Narahari,

    thanks. I tried a new webpartpage. In my webpart I just added two labels a button and the updatepanel... 

    I added the script manager and the updatepanelfix but no luck... The code behind works (changes the label with the current date/ time but still a full page reload...

    This is the tutorial I followed: http://weblogs.mysharepoint.de/blogs/fabianm/archive/2008/06/28/ajax-funktionen-in-sharepoint-webparts-integrieren.aspx  (in German)

    Thanks Bernhard

    Monday, July 15, 2013 7:33 AM
  • Hi Bernhard,

    Few things to try -

    1) Try this in a site without any custom branding or any other webparts (to make sure no other Page errors conflict with the ajax logic)

    2) Remove script manager and update panel fix. They are not required under normal circumstances.

    3) Try this in a custom application page (layouts page) instead of a visual webpart.

    4) Have the IE developer console's debugging on so as to catch any kind of JS/Ajax error.


    Monday, July 15, 2013 7:54 AM
  • Hi Narahari,

    thanks.. 3) as custom application page it works... It looks like that updatepanel doesn't work as sandbox solution. As farm solution it works "good".

    Unfortenatly I'm using a hosted Setup of Sharepoint with host-header based SiteCollections.. So I can deploy the solution only for "all" customers... 

    also the webpart and contenttypes defines in the soultion don't appear... but possibly based on my limited knowledge.. :-) Still learning..


    Monday, July 15, 2013 6:08 PM
  • as per my experience this happens with custom master pages. its due to the fact the SPWebPartManager server tag comes out of the <form></form> (<SharePoint:SharePointForm></SharePoint:SharePointForm>) tags. To sort out this please move the <asp:ScriptManager> and <WebPartPages:SPWebPartManager> inside the form tags.

    Finally it should look like below :

    <SharePoint:SharePointForm onsubmit="if (typeof(_spFormOnSubmitWrapper) != 'undefined') {return _spFormOnSubmitWrapper();} else {return true;}" runat="server">

    <SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">
            <WebPartPages:SPWebPartManager runat="Server"/>

    <asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true" />



    please refer following links for more details:



    • Edited by AmmarBIZ Monday, July 15, 2013 9:20 PM ....)
    • Proposed as answer by Lin Zhang Tuesday, July 18, 2017 5:33 AM
    Monday, July 15, 2013 8:54 PM
  • Hello Ammar,

    thanks for sharing your experience. Unfortenatly my seattle.master is OOB (out of the box) like you suggested...



    Thursday, July 18, 2013 5:22 AM
  • Hi Bernhard,

    Unfortunately you cannot use an update panel in sandboxed solutions. The reason is -

    The SB creates its own copy of the Page object and “copies” some information from the real Page object to the SB page object – but not everything such as the ScriptMgr reference etc.     : Wictor Wilen


    For sandboxed solutions, the best alternative is to use CSOM or REST Apis (very exhaustive and easy in 2013) to avoid postbacks.

    Hope it helps :-)


    Thursday, July 18, 2013 6:09 AM
  • It helped me out in my custom master page.


    Mayank Nigam

    Thursday, December 26, 2013 12:45 PM
  • I'm having this same problem, I'm on a Farm Solution and I have tried all above,still no luck! it's driving me crazy! I tried an application page with an empty masterpage;every thing is fine but in the OOB Master page all I get is this Error :

    Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters,  .......

    any one has any more ideas?! :/

    Saturday, June 7, 2014 11:47 AM
  • I have the same issue but not yet resolved.


    Suresh Kumar V.C

    Suresh Kumar VC

    Tuesday, September 15, 2015 4:57 AM
  • AmmarBIZ, You are a life saver!

    We are on SharePoint 2016. In my custom_master_page.html, I moved the following inside the body tag and it solved the problem.

    <!--MS:<SharePoint:AjaxDelta id="DeltaSPWebPartManager" runat="server">-->
                <!--MS:<WebPartPages:SPWebPartManager runat="server">-->

    Tuesday, July 18, 2017 5:36 AM
  • Works fine and thanks for your information
    Sunday, May 26, 2019 1:09 PM